repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
rainyear/pytips
Tips/2016-05-01-Class-and-Metaclass-i.ipynb
mit
def who(obj): print(id(obj), type(obj)) who(1) who(None) who(who) """ Explanation: Python 类与元类的深度挖掘 I 上一篇介绍了 Python 枚举类型的标准库,除了考虑到其实用性,还有一个重要的原因是其实现过程是一个非常好的学习、理解 Python 类与元类的例子。因此接下来两篇就以此为例,深入挖掘 Python 中类与元类背后的机制。 翻开任何一本 Python 教程,你一定可以在某个位置看到下面这两句话: Python 中一切皆为对象(Everything in Python is an object); Python...
GoogleCloudPlatform/training-data-analyst
quests/data-science-on-gcp-edition1_tf2/09_cloudml/flights_model_tf2.ipynb
apache-2.0
%pip --version import tensorflow as tf import sys print(tf.version.VERSION) print('{}.{}'.format(sys.version_info.major,sys.version_info.minor)) #%pip install --user --upgrade --quiet pip #%pip install --user --upgrade --quiet tf_nightly-2.0-preview """ Explanation: Developing, Training, and Deploying a TensorFlow ...
ambonip/Analisi-Trab
Analisi thibya Imm2000.ipynb
gpl-3.0
%matplotlib inline #importo le librerie import pandas as pd import os from __future__ import print_function,division import numpy as np import seaborn as sns os.environ["NLS_LANG"] = "ITALIAN_ITALY.UTF8" """ Explanation: <h2>Analisi comparativa dei metodi di dosaggio degli anticorpi anti recettore del TSH</h2> <h3>Met...
patemotter/trilinos-prediction
ml_files/pandas-profiling.ipynb
mit
import pandas_profiling import pandas as pd """ Explanation: This script generates profiles of pandas dataframes using the Pandas-Profiling library End of explanation """ props = pd.read_csv('../data/processed_properties.csv', header=0, index_col=0) props = props.drop_duplicates() props = props....
hongguangguo/shogun
doc/ipython-notebooks/classification/Classification.ipynb
gpl-3.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from modshogun import * #Needed lists for the final plot classifiers_linear = []*10 classifiers_non_linear = []*10 classifiers_names = []*10 fadings = []*10 """ Explanation: Visual Comparison Between Different Classification Methods in Shogun Noteb...
albahnsen/ML_SecurityInformatics
notebooks/14-KaggleCompetition.ipynb
mit
import pandas as pd import zipfile with zipfile.ZipFile('../datasets/fraud_transactions_kaggle.csv.zip', 'r') as z: f = z.open('fraud_transactions_kaggle.csv') data = pd.read_csv(f, index_col=0) data.head() data.tail() data.fraud.value_counts(dropna=False) """ Explanation: 14 - Kaggle Competition Fraud Dete...
liganega/Gongsu-DataSci
previous/y2017/Wextra/GongSu26_Pandas_Introduction_3.ipynb
gpl-3.0
from GongSu24_Pandas_Introduction_1 import * """ Explanation: Pandas 소개 3 GonsSu24 내용에 이어서 Pandas 라이브러리를 소개한다. 먼저 GongSu24를 임포트 한다. End of explanation """ obj = Series(np.arange(5.), index=['a', 'b', 'c', 'd', 'e']) obj new_obj = obj.drop('c') new_obj obj.drop(['d', 'c']) """ Explanation: 5.2.2 하나의 로우 또는 칼럼 제외하기:...
hvillanua/deep-learning
sentiment-rnn/Sentiment_RNN.ipynb
mit
import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural...
corochann/chainer-hands-on-tutorial
src/01_chainer_intro/chainer_module2.ipynb
mit
# Initial setup following http://docs.chainer.org/en/stable/tutorial/basic.html import numpy as np import chainer from chainer import cuda, Function, gradient_check, report, training, utils, Variable from chainer import datasets, iterators, optimizers, serializers from chainer import Link, Chain, ChainList import chain...
yvesdubief/UVM-ME249-CFD
ME249-Pb1-steady-laminar-channel-flow.ipynb
gpl-2.0
PDF('figures/channel.pdf',size=(300,600)) """ Explanation: <h1>Steady Laminar Channel Flow</h1> The objective of this first assignment is to compute the well-known Poiseuille velocity profile in a channel flow. Assuming that the channel length and width are both very large, the governing equations for an incompressib...
maxis42/ML-DA-Coursera-Yandex-MIPT
2 Supervised learning/Homework/5 data preparation and logistic regression/Preprocessing_LR.ipynb
mit
import pandas as pd import numpy as np import matplotlib from matplotlib import pyplot as plt matplotlib.style.use('ggplot') %matplotlib inline """ Explanation: Предобработка данных и логистическая регрессия для задачи бинарной классификации Programming assignment В задании вам будет предложено ознакомиться с основным...
ChadFulton/statsmodels
examples/notebooks/chi2_fitting.ipynb
bsd-3-clause
import numpy as np import pandas as pd import statsmodels.api as sm """ Explanation: Least squares fitting of models to data This is a quick introduction to statsmodels for physical scientists (e.g. physicists, astronomers) or engineers. Why is this needed? Because most of statsmodels was written by statisticians and ...
ZuckermanLab/NMpathAnalysis
test/example_mfpts_chignolin.ipynb
gpl-3.0
%matplotlib inline import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pyemma import mdtraj as md from glob import glob """ Explanation: Generic PyEMMA analysis pipeline for DESRES folding trajectories This notebook illustrates how to perform a simple folding analysis using the PyEMMA pa...
atcemgil/notes
Regression.ipynb
mit
# http://matplotlib.org/1.5.1/examples/pylab_examples/anscombe.html from __future__ import print_function """ Edward Tufte uses this example from Anscombe to show 4 datasets of x and y that have the same mean, standard deviation, and regression line, but which are qualitatively different. """ import matplotlib.pyplot...
guyk1971/deep-learning
embeddings/Skip-Gram word2vec.ipynb
mit
import time import numpy as np import tensorflow as tf import utils """ Explanation: Skip-gram word2vec In this notebook, I'll lead you through using TensorFlow to implement the word2vec algorithm using the skip-gram architecture. By implementing this, you'll learn about embedding words for use in natural language p...
sylvchev/coursIntroPython
cours/2-ApprendrePython-ControleExecution.ipynb
gpl-3.0
x = int(input("Entrez un entier : ")) if x < 0: x = 0 print('Négatif changé en zéro') elif x == 0: print('Zéro') elif x == 1: print ('Un seul') else: print('Plus') """ Explanation: Contrôles d'exécution A part l’instruction while que l’on vient de découvrir, Python comprend les instructions de con...
quantopian/research_public
notebooks/data/eventvestor.buyback_auth/notebook.ipynb
apache-2.0
# import the dataset from quantopian.interactive.data.eventvestor import buyback_auth as dataset # or if you want to import the free dataset, use: #from quantopian.data.eventvestor import buyback_auth_free # import data operations from odo import odo # import other libraries we will use import pandas as pd import mat...
GoogleCloudPlatform/practical-ml-vision-book
05_create_dataset/05_audio.ipynb
apache-2.0
!gsutil cp gs://ml-design-patterns/audio_train/00353774.wav cello.wav !gsutil cp gs://ml-design-patterns/audio_train/001ca53d.wav sax.wav import matplotlib.pyplot as plt from scipy import signal from scipy.io import wavfile import numpy as np fig, ax = plt.subplots(2, 2, figsize=(15, 10)) for idx, instr in enumerate(...
Unidata/unidata-python-workshop
notebooks/CF Conventions/NetCDF and CF - The Basics.ipynb
mit
# Import some useful Python tools from datetime import datetime, timedelta import numpy as np # Twelve hours of hourly output starting at 22Z today start = datetime.utcnow().replace(hour=22, minute=0, second=0, microsecond=0) times = np.array([start + timedelta(hours=h) for h in range(13)]) # 3km spacing in x and y ...
McWilliamsCenter/CMUDeepLens
notebooks/BLF_GroundBased.ipynb
mit
import sys sys.path.append('..') %load_ext autoreload %autoreload 2 %pylab inline """ Explanation: Strong Lens Finding Challenge In this notebook, we illustrate how to use CMU DeepLens to classify ground based images from the strong lens finding challenge http://metcalf1.difa.unibo.it/blf-portal/gg_challenge.html End ...
saashimi/code_guild
interactive-coding-challenges/stacks_queues/n_stacks/n_stacks_challenge.ipynb
mit
class Stacks(object): def __init__(self, num_stacks, stack_size): # TODO: Implement me pass def abs_index(self, stack_index): # TODO: Implement me pass def push(self, stack_index, data): # TODO: Implement me pass def pop(self, stack_index): # T...
kylepolich/dataskeptic
shownotes/the-elbow-method.ipynb
cc0-1.0
%matplotlib inline import os import json import pickle import geocoder import math import random import pandas as pd import numpy as np from scipy.spatial import cKDTree import matplotlib.pyplot as plt addresses = {} root = '../data/' allfiles = [] dirs = os.listdir(root) for d in dirs: files = os.listdir(root + ...
mne-tools/mne-tools.github.io
0.22/_downloads/96cdfef13f5475e2f32b862fa94904b7/plot_visualize_stc.ipynb
bsd-3-clause
import os import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import apply_inverse, read_inverse_operator from mne import read_evokeds data_path = sample.data_path() sample_dir = os.path.join(data_path, 'MEG', 'sample') subjects_dir...
TareasJF/INF393
T1/Tarea1.ipynb
mit
import pandas as pd import numpy as np df = pd.read_csv("kc_house_data.csv") df.drop(['id','date','zipcode',],axis=1,inplace=True) df.head() """ Explanation: 1.- Regresión Lineal Ordinaria (LSS) En esta sección trabajaremos con un dataset conocido como House Sales in King County, USA, presentado en la plataforma de Ka...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/pos_stl.ipynb
apache-2.0
!pip install hanlp -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/pos_stl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Ope...
ZhiangChen/deep_learning
thesis/supervised_learning/Supervised Object Classification.ipynb
mit
import numpy as np import tensorflow as tf from six.moves import cPickle as pickle import matplotlib.pyplot as plt import random import operator import time import os import math """ Explanation: Supervised Object Classification Zhiang Chen, March 2017 - Xazier initialization - Dropout - Rectified linear units - Leaky...
streety/biof509
Wk09-Advanced-ML-tasks-Deep-Learning.ipynb
mit
import matplotlib.pyplot as plt %matplotlib inline plt.gray() from keras.datasets import mnist (X_train, y_train), (X_test, y_test) = mnist.load_data() fig, axes = plt.subplots(3,5, figsize=(12,8)) for i, ax in enumerate(axes.flatten()): ax.imshow(X_train[i], interpolation='nearest') plt.show() from keras.models ...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session04/Day0/TooBriefMLSolutions.ipynb
mit
import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Introduction to Machine Learning: Examples of Unsupervised and Supervised Machine-Learning Algorithms Version 0.1 Broadly speaking, machine-learning methods constitute a diverse collection of data-driven algorithms designed to class...
Paradigm4/wearable_prototypes
sleep.ipynb
agpl-3.0
from scidbpy import connect import getpass import requests import warnings warnings.filterwarnings("ignore") requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) db = connect(scidb_url="https://localhost:8083", scidb_auth=('root', getpass.getpass('Please ...
mathnathan/notebooks
dissertation/KL Upper Bound and Applications.ipynb
mit
import numpy as np import matplotlib #matplotlib.use('nbagg') import matplotlib.pyplot as plt x = np.linspace(1e-6,1,200) y1 = -np.log(x) y2 = -5*x+5 plt.plot(x,y1,label='$-\log p(x)$',lw=2) plt.plot(x,y2,label='$-5p(x)+5$',lw=2) plt.xlabel("$p(x)$") plt.ylim(-0.5,10) plt.tight_layout() plt.legend() plt.show() """ E...
isendel/machine-learning
ml-regression/week 6/week-6-local-regression-assignment-blank.ipynb
apache-2.0
import graphlab """ Explanation: Predicting house prices using k-nearest neighbors regression In this notebook, you will implement k-nearest neighbors regression. You will: * Find the k-nearest neighbors of a given query input * Predict the output for the query input using the k-nearest neighbors * Choose the be...
jasontlam/snorkel
tutorials/workshop/Workshop_2_Writing_Labeling_Functions.ipynb
apache-2.0
%load_ext autoreload %autoreload 2 %matplotlib inline import re import sys import numpy as np # Connect to the database backend and initalize a Snorkel session from lib.init import * from lib.scoring import * from lib.lf_factories import * from snorkel.lf_helpers import test_LF from snorkel.annotations import load_g...
karlstroetmann/Artificial-Intelligence
Python/6 Classification/Spam-Detection.ipynb
gpl-2.0
import os import re import math """ Explanation: Spam Detection Using the Naive Bayes Algorithm The process of creating a spam detector using the naive Bayes algorithm is split up into four steps. Create a set of the most common words occurring in spam and ham (i.e. non-spam) emails. For every word occurring in this...
scotthuang1989/Python-3-Module-of-the-Week
networking/TCPIP Client and Server.ipynb
apache-2.0
# %load socket_echo_server.py import socket import sys # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port server_address = ('localhost', 10000) print('starting up on {} port {}'.format(*server_address)) sock.bind(server_address) # Listen for incoming conne...
meli-lewis/osb2015
OSB2015_intro_data.ipynb
mit
from __future__ import division import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn import rpy2 from IPython.display import display, Image, YouTubeVideo %matplotlib inline """ Explanation: bit.ly/osb2015pandas Introduction to data munging with Jupyter and p...
w4zir/ml17s
lectures/lec04-linear-regression-example.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np from sklearn import linear_model import matplotlib.pyplot as plt # read data in pandas frame dataframe = pd.read_csv('datasets/example1.csv', encoding='utf-8') # assign x and y X = np.array(dataframe[['x']]) y = np.array(dataframe[['y']]) m = y.size # number ...
DJCordhose/ai
notebooks/rl/berater_chh_181104.ipynb
mit
# !pip install -e git+https://github.com/openai/baselines#egg=berater """ Explanation: <a href="https://colab.research.google.com/github/DJCordhose/ai/blob/master/notebooks/rl/berater_chh_181104.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Berate...
yashdeeph709/Algorithms
PythonBootCamp/Complete-Python-Bootcamp-master/Objects and Data Structures Assessment Test-Solution.ipynb
apache-2.0
# Your answer is probably different (20000 - (10 ** 2) / 12 * 34) - 19627.75 """ Explanation: Objects and Data Structures Assessment Test Test your knowledge. Answer the following questions Write a brief description of all the following Object Types and Data Structures we've learned about: For the full answers, rev...
jdhp-docs/python-notebooks
python_sklearn_decision_trees_fr.ipynb
mit
from sklearn import tree """ Explanation: Les arbres de décision avec Python/Scikit-learn http://scikit-learn.org/stable/modules/tree.html End of explanation """ X = [[0, 0], [1, 1]] Y = [0, 1] clf = tree.DecisionTreeClassifier() clf = clf.fit(X, Y) clf.predict([[2., 2.]]) clf.predict_proba([[2., 2.]]) """ Expla...
linhbngo/cpsc-4770_6770
19-message-oriented-middleware-producer.ipynb
gpl-3.0
!cd ~/software/kafka_2.11-1.0.0; \ ./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic test !cd ~/software/kafka_2.11-1.0.0; \ ./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test !cd ~/software/kafka_2.11-1.0.0; \ ./bin/kafka-topics.sh -...
ES-DOC/esdoc-jupyterhub
notebooks/csir-csiro/cmip6/models/sandbox-3/atmoschem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-3', 'atmoschem') """ Explanation: ES-DOC CMIP6 Model Properties - Atmoschem MIP Era: CMIP6 Institute: CSIR-CSIRO Source ID: SANDBOX-3 Topic: Atmoschem Sub-Topics: Transport...
abulbasar/machine-learning
Time Series - Stock Price Forecast using ARIMA.ipynb
apache-2.0
df = pd.read_csv("https://raw.githubusercontent.com/abulbasar/data/master/tcs-stock.csv") df.head() """ Explanation: Download stock price data from NSE website. Here I download stock price data for TCS stock. End of explanation """ df[df["Date"].duplicated(keep = False)] """ Explanation: Check whether you have dupl...
jrbourbeau/cr-composition
notebooks/learning-curve.ipynb
mit
import argparse from collections import defaultdict import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import seaborn.apionly as sns from sklearn.metrics import accuracy_score from sklearn.model_selection import cross_val_score, learning_curve import co...
arkottke/pysra
examples/example-12.ipynb
mit
import itertools import matplotlib.pyplot as plt import numpy as np import pandas as pd import pysra %matplotlib inline plt.rcParams["figure.dpi"] = 150 """ Explanation: Compare impact of frequency dependent $D_{min}$ End of explanation """ plast_indices = [0, 20, 50, 100] stresses_mean = 101.3 * np.array([0.5, ...
mjysci/ud-dlnd-side-proj
p2_image_classification/image_classification.ipynb
gpl-3.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...
soloman817/udacity-ml
misc/DLND-your-first-network/dlnd-your-first-neural-network.ipynb
mit
%matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt """ Explanation: Your first neural network In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code...
grigorisg9gr/menpo-notebooks
menpo/Transforms/Piecewise_Affine.ipynb
bsd-3-clause
import numpy as np from menpo.transform import PiecewiseAffine """ Explanation: Piecewise Affine Transforms End of explanation """ from menpo.shape import TriMesh, PointCloud a = np.array([[0, 0], [1, 0], [0, 1], [1, 1], [-0.5, -0.7], [0.8, -0.4], [0.9, -2.1]]) b = np.array([[0,0], [2, 0], [-1, 3], [2,...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session01/Day2/IntroStat.ipynb
mit
fig = plt.figure(1,figsize=(8,8)) for ii in range(1, 10): rv = scipy.stats.norm.rvs(0, 1, size = 200) ax = fig.add_subplot(3,3,ii) sm.qqplot(rv, line = 's', ax = ax) ax.set_xlabel('') ax.set_ylabel('') fig.text(0.5, 0.02, 'Theoretical Quantiles', ha='center',size=16) fig.text(0.02, 0.5, 'Observed Qu...
antoniomezzacapo/qiskit-tutorial
community/hello_world/quantum_8ball.ipynb
apache-2.0
# begin with importing essential libraries for IBM Q from qiskit import IBMQ from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit """ 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" ...
openfisca/openfisca-france-indirect-taxation
openfisca_france_indirect_taxation/examples/notebooks/compare_depenses_transports.ipynb
agpl-3.0
from __future__ import division import pkg_resources import os import pandas as pd from pandas import concat import seaborn """ Explanation: L'objectif des "compare" est d'évaluer la qualité des calages effectués. Ils comparent les dépenses ou quantités agrégées de Budget des Familles après calage, avec celles de la...
ToqueWillot/M2DAC
FDMS/TME3/Model_V2.ipynb
gpl-2.0
# from __future__ import exam_success from __future__ import absolute_import from __future__ import print_function %matplotlib inline import sklearn import matplotlib.pyplot as plt import seaborn as sns import numpy as np import random import pandas as pd import scipy.stats as stats # Sk cheats from sklearn.cross_val...
acdarby/Python_lectures
Lecture_2.ipynb
gpl-3.0
exam_scores = [67,78,94,45,55,66] print("scores: " ,exam_scores) """ Explanation: Lecture 2 – Lists, conditionals and loops Recap on Variables A variable named cell of memory storing a single value Assigned a value using the equals symbol Can be given any name you like Except no spaces and cannot start with a number...
JaggedParadigm/pyplearnr
.ipynb_checkpoints/data_science_lib_demo-checkpoint.ipynb
apache-2.0
import pandas as pd df = pd.read_pickle('trimmed_titanic_data.pkl') df.info() """ Explanation: pyplearnr demo Here I demonstrate pyplearnr, a wrapper for building/training/validating scikit learn pipelines using GridSearchCV or RandomizedSearchCV. Quick keyword arguments give access to optional feature selection (e....
MichalBusta/clstm
misc/lstm-delay.ipynb
apache-2.0
net = clstm.make_net_init("lstm1","ninput=1:nhidden=4:noutput=2") print net net.setLearningRate(1e-4,0.9) print clstm.network_info(net) """ Explanation: Network creation and initialization is very similar to C++: networks are created using the make_net(name) factory function the net.set(key,value) method is used to ...
arcyfelix/Courses
18-11-22-Deep-Learning-with-PyTorch/02-Introduction to PyTorch/Part 5 - Inference and Validation.ipynb
apache-2.0
import torch from torchvision import datasets, transforms # Define a transform to normalize the data transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) # Download and load t...
vikasgorur/notebooks
cs229/Linear Regression.ipynb
mit
%matplotlib inline import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from sklearn.preprocessing import scale """ Explanation: CS229: Lecture 2 Linear Regression, Gradient Descent In this notebook we implement some of the concepts discussed in Lecture 2 of CS229 - Machine Le...
LSSTDESC/Twinkles
examples/notebooks/Sort_Objects_in_ICs.ipynb
mit
import pandas as pd import numpy as np """ Explanation: Sorting Objects in Instance Catalogs Bryce Kalmbach This notebook provides a series of commands that take a Twinkles Phosim Instance Catalog and creates different pandas dataframes for different types of objects in the catalog. It first separates the full sets of...
mne-tools/mne-tools.github.io
stable/_downloads/ab9aa98c1c3d10ded0b9447abaef0b61/30_ecog.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Chris Holdgraf <choldgraf@gmail.com> # Adam Li <adam2392@gmail.com> # Alex Rockhill <aprockhill@mailbox.org> # Liberty Hamilton <libertyhamilton@gmail.com> # # License: BSD-3-Clause import os.path as op import numpy as np import ma...
macks22/gensim
docs/notebooks/topic_coherence_tutorial.ipynb
lgpl-2.1
from __future__ import print_function import os import logging import json import warnings try: import pyLDAvis.gensim CAN_VISUALIZE = True pyLDAvis.enable_notebook() from IPython.display import display except ImportError: ValueError("SKIP: please install pyLDAvis") CAN_VISUALIZE = False impo...
madsenmj/ml-introduction-course
Class04/Class04.ipynb
apache-2.0
import pandas as pd import seaborn as sns sns.set_style("white") #Note the new use of the dtype option here. We can directly tell pandas to use the Speed column as a category in one step. speeddf = pd.read_csv("Class04_speed_data.csv",dtype={'Speed':'category'}) lm = sns.lmplot(x='Grade', y='Bumpiness', data=speeddf,...
NYUDataBootcamp/Projects
UG_S16/Mammon-Obesity.ipynb
mit
%matplotlib inline import pandas as pd import pandas.io.data as web import matplotlib.pyplot as plt import numpy as np import datetime as dt """ Explanation: Are income and Childhood Obesity Correlated? Jennifer Mammon May 2016 Childhood Obesity in the USA "Overweight" is defined as having excess body weight for a par...
diegocavalca/Studies
deep-learnining-specialization/1. neural nets and deep learning/week4/Building+your+Deep+Neural+Network+-+Step+by+Step+v5.ipynb
cc0-1.0
import numpy as np import h5py import matplotlib.pyplot as plt from testCases_v3 import * from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['imag...
amitkaps/applied-machine-learning
reference/Module-02c-reference.ipynb
mit
#Load the libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt #Default Variables %matplotlib inline plt.rcParams['figure.figsize'] = (16,9) plt.rcParams['font.size'] = 18 plt.style.use('fivethirtyeight') pd.set_option('display.float_format', lambda x: '%.2f' % x) #Load the dataset df = pd...
vinaykumar2491/Lumos
Project_Python/py_bootcamp/decorators.ipynb
apache-2.0
def func(): return 1 func() s = 'this is a global variable' def func(): print locals() print globals()['s'] func() def hello(name = 'rustom'): return 'Hello ' + name hello() greet = hello greet greet() # del hello greet greet() hello() greet2 = hello() greet2 greet2() del hello greet2 gr...
mne-tools/mne-tools.github.io
0.13/_downloads/plot_spm_faces_dataset.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import os.path as op import matplotlib.pyplot as plt import mne from mne.datasets import spm_face from mne.preprocessing import ICA, create_eog_epochs from mne impor...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/structured/labs/4c_keras_wide_and_deep_babyweight.ipynb
apache-2.0
import datetime import os import shutil import matplotlib.pyplot as plt import numpy as np import tensorflow as tf print(tf.__version__) """ Explanation: LAB 4c: Create Keras Wide and Deep model. Learning Objectives Set CSV Columns, label column, and column defaults Make dataset of features and label from CSV files ...
fermiPy/fermipy-extra
notebooks/dSphs.ipynb
bsd-3-clause
pipe = Pipeline(linkname = 'dSphs') configfile = 'config/master_dSphs.yaml' """ Explanation: First we build a pipeline object to analyze the dSphs, and point it at the config file for the dSphs analysis. End of explanation """ pipe.preconfigure(configfile) """ Explanation: We have to 'preconfigure' the pipeline, b...
sdpython/ensae_teaching_cs
_doc/notebooks/exams/td_note_2020_1.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() """ Explanation: 1A.e - Enoncé 22 octobre 2019 (1) Correction du premier énoncé de l'examen du 22 octobre 2019. L'énoncé propose une façon de disposer des tables rondes dans une salle ronde. End of explanation """ def distance_table(x1, y1, x2, y2): ...
evanmiltenburg/python-for-text-analysis
Assignments/ASSIGNMENT-2.ipynb
apache-2.0
for number in range(4, 0, -1): # change 4 to 99 when you're done with debugging print(number, 'bottles of beer on the wall,') """ Explanation: Assignment 2: Containers Deadline: Tuesday, September 21, 2021 before 20:00 Please name your files: ASSIGNMENT_2_FIRSTNAME_LASTNAME.ipynb assignment2_utils.py Please s...
gvasold/gdp17
basics/basics_3.ipynb
apache-2.0
# TODO """ Explanation: Strings revisited Vorbemerkung In diesem Notebook verwenden wir den Text "Der Mann von vierzig Jahren" von Jakob Wassermann. Dieser Text stammt aus dem Jahr 1913 und wurde vom Projekt Gutenberg digitalisiert (http://www.gutenberg.org/ebooks/15736). Um die Arbeit mit dem Text zu erleichtern, hab...
kmyokoyama/mathings
euler_method.ipynb
apache-2.0
def euler(x_0, y_0, f, step=0.001, k_max=None): r""" Euler's method for solving first-order ODE. The function computes `k_max` iterations from the initial conditions `x_0` and `y_0` with steps of size `step`. It yields a total of `k_max` + 1 values. The recorrent equation is: y_{k+1} = y_{...
qutip/qutip-notebooks
examples/bloch_sphere_with_colorbar.ipynb
lgpl-3.0
import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from qutip import * from qutip.ipynbtools import version_table %matplotlib inline """ Explanation: Adding a colorbar to a Bloch Sphere End of explanation """ delta = 0.5 * 2 *...
ledeprogram/algorithms
class7/donow/Gruen_Gianna_7_donow.ipynb
gpl-3.0
import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import numpy as np from sklearn.linear_model import LogisticRegression """ Explanation: Apply logistic regression to categorize whether a county had high mortality rate due to contamination 1. Import the necessary packages to read in the data, plot...
kubeflow/kfp-tekton-backend
components/gcp/dataproc/create_cluster/sample.ipynb
apache-2.0
%%capture --no-stderr KFP_PACKAGE = 'https://storage.googleapis.com/ml-pipeline/release/0.1.14/kfp.tar.gz' !pip3 install $KFP_PACKAGE --upgrade """ Explanation: Name Data processing by creating a cluster in Cloud Dataproc Label Cloud Dataproc, cluster, GCP, Cloud Storage, KubeFlow, Pipeline Summary A Kubeflow Pipelin...
Bollegala/bollegala.github.io
lect/dm/PCA.ipynb
mit
import numpy """ Explanation: Let us consider four two-dimensional data points x1 = (1,1), x2 = (1, -1), x3 = (-1, -1), and x4 = (-1,1). Use PCA to project these four data points into an one-dimensional space. End of explanation """ X = numpy.zeros((2, 4), dtype=float) X[:, 0] = numpy.array([1, 1]) X[:, 1] = numpy.a...
wuafeing/Python3-Tutorial
01 data structures and algorithms/01.04 find largest or smallest n items.ipynb
gpl-3.0
import heapq nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print(heapq.nlargest(3, nums)) print(heapq.nsmallest(3, nums)) """ Explanation: Previous 1.4 查找最大或最小的N个元素 问题 怎样从一个集合中获得最大或者最小的 N 个元素列表? 解决方案 heapq 模块有两个函数:nlargest() 和 nsmallest() 可以完美解决这个问题。 End of explanation """ portfolio = [ {'name': 'IBM', 'share...
AtmaMani/pyChakras
islr/verifying_central_limit_theorem.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: Verifying Central Limit Theorem The Central Limit Theorem states that the sampling distribution of the sampling means approaches a normal distribution as the sample size gets larger — no mat...
g-weatherill/catalogue_toolkit
notebooks/Catalogue Querying Example.ipynb
agpl-3.0
%matplotlib inline import os, sys import numpy as np import matplotlib.pyplot as plt from eqcat.parsers.isf_catalogue_reader import ISFReader import eqcat.catalogue_query_tools as cqt """ Explanation: Catalogue Query Tools This notebook provides examples on how to use the Catalogue Toolkit to build and explore a catal...
chapagain/kaggle-competitions-solution
Titanic: Machine Learning from Disaster/Titanic.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns sns.set() # setting seaborn default for plots """ Explanation: TITANIC SOLUTION A BEGINNER'S GUIDE Loading Modules End of explanation """ train = pd.read_csv('train.csv') test = pd.read_csv('test.csv') ""...
pdamodaran/yellowbrick
examples/iguk1987/Yellowbrick_Tour.ipynb
apache-2.0
import numpy as np import pandas as pd %matplotlib inline from cycler import cycler import matplotlib.style import matplotlib as mpl mpl.style.use('seaborn-white') import matplotlib.pyplot as plt from matplotlib.pyplot import figure from sklearn.cluster import KMeans from sklearn.linear_model import RidgeCV from sklear...
hektor-monteiro/curso-python
aula-1.ipynb
gpl-2.0
print "Hello World!" x=1 # vendo os valores de x print (x) print x x """ Explanation: Livro base http://www-personal.umich.edu/~mejn/computational-physics/ Programando em Python O primeiro passo é aprender a programar em python Python é uma linguagem de alto nível, poderosa e muito abrangente vamos nos limitar aos a...
GoogleCloudPlatform/training-data-analyst
quests/rl/a2c/a2c_on_gcp.ipynb
apache-2.0
!pip install tensorflow==2.1 --user """ Explanation: Policy Gradients and A2C In the <a href="../dqn/dqns_on_gcp.ipynb">previous notebook</a>, we learned how to use hyperparameter tuning to help DQN agents balance a pole on a cart. In this notebook, we'll explore two other types of alogrithms: Policy Gradients and A2C...
Cyb3rWard0g/HELK
docker/helk-jupyter/notebooks/tutorials/01-intro-to-python.ipynb
gpl-3.0
for x in list(range(5)): print("One number per loop..") print(x) if x > 2: print("The number is greater than 2") print("----------------------------") """ Explanation: Introduction to Python Goals: Learn basic Python operations Understand differences in data structures Get familiarized wi...
IST256/learn-python
content/lessons/05-Functions/LAB-Functions.ipynb
mit
import math dir(math) """ Explanation: Class Coding Lab: Functions The goals of this lab are to help you to understand: How to use Python's built-in functions in the standard library. How to write user-defined functions How to use other people's code. The benefits of user-defined functions to code reuse and simplicit...
anilcs13m/MachineLearning_Mastering
week-4-ridge-regression-assignment-2-blank.ipynb
gpl-2.0
import graphlab import numpy as np """ Explanation: Regression Week 4: Ridge Regression (gradient descent) In this notebook, you will implement ridge regression via gradient descent. You will: * Convert an SFrame into a Numpy array * Write a Numpy function to compute the derivative of the regression weights with respe...
splicemachine/splice-community-sample-code
twimlcon-workshop-materials/3 - Model Training.ipynb
apache-2.0
#Begin spark session from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() #Create pysplice context. Allows you to create a Spark dataframe using our Native Spark DataSource from splicemachine.spark import PySpliceContext splice = PySpliceContext(spark) #Initialize our Feature Store API fr...
jsjol/GaussianProcessRegressionForDiffusionMRI
notebooks/compute_ODF.ipynb
bsd-3-clause
btable = np.loadtxt(get_data('dsi515btable')) #btable = np.loadtxt(get_data('dsi4169btable')) gtab['test'] = gradient_table(btable[:, 0], btable[:, 1:], big_delta=gtab['train'].big_delta, small_delta=gtab['train'].small_delta) gtab['test'].info """ Explanation: For the testing we will us...
Z0m6ie/Zombie_Code
Data_Science_Course/Michigan Data Analysis Course/0 Introduction to Data Science in Python/Week2/Week+2.ipynb
mit
import pandas as pd pd.Series? animals = ['Tiger', 'Bear', 'Moose'] pd.Series(animals) numbers = [1, 2, 3] pd.Series(numbers) animals = ['Tiger', 'Bear', None] df = pd.Series(animals) df['number_column'] = -99999 df numbers = [1, 2, None] pd.Series(numbers) import numpy as np np.nan == None np.nan == np.nan np.i...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_channel_epochs_image.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ Explanation: Visualize channel over epochs as an ima...
ahoyosid/ReNA
Example_Neuroimaging.ipynb
bsd-3-clause
from nilearn import datasets dataset = datasets.fetch_haxby(subjects=1) import numpy as np from nilearn.input_data import NiftiMasker masker = NiftiMasker(mask_strategy='epi', smoothing_fwhm=6, memory='cache') X_masked = masker.fit_transform(dataset.func[0]) X_train = X_masked[:100, :] X_data = masker.inverse_transf...
analysiscenter/dataset
examples/tutorials/04_linear_models_example.ipynb
apache-2.0
import sys import warnings warnings.filterwarnings("ignore") import numpy as np import tensorflow as tf import matplotlib.pyplot as plt %matplotlib inline # the following line is not required if BatchFlow is installed as a python package. sys.path.append('../..') from batchflow import Dataset, V, F, B, action, Batch...
davidhamann/python-fmrest
examples/fetching_container_data.ipynb
mit
import fmrest fms = fmrest.Server('https://10.211.55.15', user='admin', password='admin', database='Contacts', layout='Demo', verify_ssl=False ) fms.login() """ Explanation: Fetching container data w...
aakashm301/Workshop
Refactored_Py_DS_ML_Bootcamp-master/11-Linear-Regression/03-Linear Regression Project - Solutions.ipynb
gpl-3.0
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Linear Regression Project - Solutions Congratulations! You just got some contract work with an Ecommerce com...
WMD-group/sulfur-model
parameterisation.ipynb
gpl-3.0
import ase.db import ase.thermochemistry from scipy import constants from sulfur import cm_to_hz, reference_energy #from sulfur.core import get_potentials, unpack_data, reference_energy, solve_composition db_file = sulfur.__path__[0] + '/../data/sulfur_pbe0_96.json' ref_energy = reference_energy(db_file) c = ase.db.con...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_dipole_fit.ipynb
bsd-3-clause
from os import path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.forward import make_forward_dipole from mne.evoked import combine_evoked from mne.simulation import simulate_evoked data_path = mne.datasets.sample.data_path() subjects_dir = op.join(data_path, 'subjects') fname_ave = op....
seinberg/deep-learning
weight-initialization/weight_initialization.ipynb
mit
%matplotlib inline import tensorflow as tf import helper from tensorflow.examples.tutorials.mnist import input_data print('Getting MNIST Dataset...') mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) print('Data Extracted.') """ Explanation: Weight Initialization In this lesson, you'll learn how to fin...
laurent-george/tutmom
mystic.ipynb
bsd-3-clause
%matplotlib inline """ Explanation: Optimiztion with mystic End of explanation """ """ Example: - Minimize Rosenbrock's Function with Nelder-Mead. - Plot of parameter convergence to function minimum. Demonstrates: - standard models - minimal solver interface - parameter trajectories using retall...
Hvass-Labs/TensorFlow-Tutorials
21_Machine_Translation.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import tensorflow as tf import numpy as np import math import os """ Explanation: TensorFlow Tutorial #21 Machine Translation by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube Introduction Tutorial #20 showed how to use a Recurrent Neural Network (RNN) to do ...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/gapic/automl/showcase_automl_image_classification_batch.ipynb
apache-2.0
import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex client library: AutoML image classification model for batch prediction <table align=...
landmanbester/fundamentals_of_interferometry
2_Mathematical_Groundwork/2_3_fourier_series.ipynb
gpl-2.0
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from IPython.display import HTML HTML('../style/course.css') #apply general CSS """ Explanation: Outline Glossary 2. Mathematical Groundwork Previous: 2.2 Important functions Next: 2.4 The Fourier Transform Import standard modules: End of expla...