repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
ToqueWillot/M2DAC | FDMS/TME2/TME2FDMS_Florian_Toque.ipynb | gpl-2.0 | %matplotlib inline
import sklearn
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import random
import copy
from sklearn.datasets import fetch_mldata
from sklearn import cross_validation
from sklearn import base
from sklearn.linear_model import Lasso
from sklearn.linear_model import ElasticNet... |
jsafyan/style-transfer-theano | src/vgg19/neural-style-transfer.ipynb | mit | from NeuralStyle import NeuralStyleTransfer
"""
Explanation: Neural Style Transfer
End of explanation
"""
content_path = 'images/tubingen.jpg'
style_path = 'images/starry_night.jpg'
nst = NeuralStyleTransfer(content_path, style_path, image_w=300, image_h=300)
"""
Explanation: Tutorial
Specify the paths for the co... |
ML4DS/ML4all | TM3.Topic_Models_with_MLlib/TM3_TMwithMLlib.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import pylab
# Required imports
from wikitools import wiki
from wikitools import category
# import nltk
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
from test_helper import Test
impor... |
sraejones/phys202-2015-work | assignments/assignment05/InteractEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact, interactive, fixed
from IPython.display import display
"""
Explanation: Interact Exercise 3
Imports
End of explanation
"""
def soliton(x, t, c, a):
"""Return phi(x, t) for a soliton wave with co... |
mbeyeler/opencv-machine-learning | notebooks/08.04-Implementing-Agglomerative-Hierarchical-Clustering.ipynb | mit | from sklearn.datasets import make_blobs
X, y = make_blobs(n_samples=10, random_state=100)
"""
Explanation: <!--BOOK_INFORMATION-->
<a href="https://www.packtpub.com/big-data-and-business-intelligence/machine-learning-opencv" target="_blank"><img align="left" src="data/cover.jpg" style="width: 76px; height: 100px; back... |
liganega/Gongsu-DataSci | notebooks/GongSu03_Python_DataTypes_Part_1.ipynb | gpl-3.0 | print("Hello World")
"""
Explanation: 파이썬 기본 자료형 1부
파이썬 언어에서 사용되는 값들의 기본 자료형을 살펴본다.
변수에 할당될 수 있는 가장 단순한 자료형에는 네 종류가 있다:
정수 자료형(int):
..., -3, -2, -1, 0, 1, 2, 3, 등등
1 + 2, -2 * 3, 등등
부동소수점 자료형(float):
1.2, 0.333333, -1.2, -3.7680, 등등
2.0/3.5, 3.555 + 3.4 * 7.9, 등등
불리언 자료형(bool): True, False를 포함하여 두 값으로 계... |
VVard0g/ThreatHunter-Playbook | docs/notebooks/windows/07_discovery/WIN-190826010110.ipynb | mit | from openhunt.mordorutils import *
spark = get_spark()
"""
Explanation: Remote Service Control Manager Handle
Metadata
| Metadata | Value |
|:------------------|:---|
| collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] |
| creation date | 2019/08/26 |
| modification date | 2020/09/20 |
| playbook rel... |
barjacks/pythonrecherche | Kursteilnehmer/Sven Millischer/06 /03 Python Functions, 10 Übungen.ipynb | mit | def test(element):
element = element * 2
return element
"""
Explanation: 03 Python Functions, 10 Übungen
Hier nochmals zur Erinnerung, wie Funktionen geschrieben werden.
End of explanation
"""
test(5)
"""
Explanation: Multipliziert Integers oder Floats mit 2
End of explanation
"""
lst = [12, 45, 373, 1028... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive/02_generalization/create_datasets.ipynb | apache-2.0 | from google.cloud import bigquery
import seaborn as sns
import pandas as pd
import numpy as np
import shutil
"""
Explanation: <h1> Explore and create ML datasets </h1>
In this notebook, we will explore data corresponding to taxi rides in New York City to build a Machine Learning model in support of a fare-estimation ... |
hunterherrin/phys202-2015-work | assignments/assignment05/MatplotlibEx03.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: Matplotlib Exercise 3
Imports
End of explanation
"""
def well2d(x, y, nx, ny, L=1.0):
"""Compute the 2d quantum well wave function."""
i=np.sin(nx*np.pi*x/L)
o=np.sin(ny*np.pi*y/L)
return((2/L)*i*o)
psi = well2d(n... |
tensorflow/docs-l10n | site/zh-cn/agents/tutorials/4_drivers_tutorial.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... |
google/applied-machine-learning-intensive | content/04_classification/04_classification_project/colab.ipynb | apache-2.0 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the L... |
tensorflow/docs-l10n | site/ko/tutorials/generative/dcgan.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... |
mcamack/Jupyter-Notebooks | NLP/NLP101 - Tokenization, Sentiment.ipynb | apache-2.0 | from nltk.tokenize import TreebankWordTokenizer
sentence = "How does nltk tokenize this sentence?"
tokenizer = TreebankWordTokenizer()
tokenizer.tokenize(sentence)
"""
Explanation: Natural Language Processing (NLP)
Overview
corpus - collection of texts
lexicon - collection of words (or sequences) we put into our ind... |
DJCordhose/ai | notebooks/tf2/tf-low-level.ipynb | mit | !pip install -q tf-nightly-gpu-2.0-preview
import tensorflow as tf
print(tf.__version__)
# a small sanity check, does tf seem to work ok?
hello = tf.constant('Hello TF!')
print("This works: {}".format(hello))
# this should return True even on Colab
tf.test.is_gpu_available()
tf.test.is_built_with_cuda()
!nvidia-sm... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/solutions/mlmd_tutorial.ipynb | apache-2.0 | !pip install --upgrade pip
"""
Explanation: Better ML Engineering with ML Metadata
Learning Objectives
Download the dataset
Create an InteractiveContext
Construct the TFX Pipeline
Query the MLMD Database
Introduction
Assume a scenario where you set up a production ML pipeline to classify penguins. The pipeline inges... |
rsterbentz/phys202-2015-work | assignments/assignment09/IntegrationEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy import integrate
import math # From https://docs.python.org/3.3/library/math.html
"""
Explanation: Integration Exercise 2
Imports
End of explanation
"""
def integrand(x, a):
return 1... |
liyigerry/msm_test | examples/bayesian-msm.ipynb | apache-2.0 | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from mdtraj.utils import timing
from msmbuilder.example_datasets import load_doublewell
from msmbuilder.cluster import NDGrid
from msmbuilder.msm import BayesianMarkovStateModel, MarkovStateModel
"""
Explanation: BayesianMarkovStateModel
This e... |
rocketproplab/Guides | Guides/python/excelToPandas.ipynb | mit | import pandas as pd
import os
"""
Explanation: Import Excel or CSV To Pandas
This file covers the process of importing excel and csv files into a pandas dataframe. Note: the methods for importing excel and csv files is almost identical. The major difference is in the method used. This notebook serves as a tutorial for... |
rasilab/ferrin_elife_2017 | scripts/run_simulations_whole_cell_parameter_sweep.ipynb | gpl-3.0 | # sequence input and output
import Bio.SeqIO
# provides dictionary of codon names
from Bio.SeqUtils.CodonUsage import SynonymousCodons
# for converting 3 letter amino acid code to 1 letter code
from Bio.SeqUtils import seq1
# for fast access of fasta files
import pyfaidx
# for parsing GFF3 files
import HTSeq
# for tab ... |
karlstroetmann/Artificial-Intelligence | Python/2 Constraint Solver/Local-Search.ipynb | gpl-2.0 | import extractVariables as ev
"""
Explanation: Local Search
Utility Functions
The module extractVariables implements the function $\texttt{extractVars}(e)$ that takes a Python expression $e$ as its argument and returns the set of all variables and function names occurring in $e$.
End of explanation
"""
def collect_v... |
remenska/iSDM | notebooks/old/DemoFramework-IUCN.ipynb | apache-2.0 | import logging
root = logging.getLogger()
root.addHandler(logging.StreamHandler())
%matplotlib inline
"""
Explanation: Working with IUCN data in shapefiles
just some logging/plotting magic to output in this notebook, nothing to care about.
End of explanation
"""
# download http://bit.ly/1R8pt20 (zipped Turtles shape... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/ml_ops/stage2/mlops_experimentation.ipynb | apache-2.0 | import os
# The Vertex AI Workbench Notebook product has specific requirements
IS_WORKBENCH_NOTEBOOK = os.getenv("DL_ANACONDA_HOME")
IS_USER_MANAGED_WORKBENCH_NOTEBOOK = os.path.exists(
"/opt/deeplearning/metadata/env_version"
)
# Vertex AI Notebook requires dependencies to be installed with '--user'
USER_FLAG = ... |
radu941208/DeepLearning | Convolutional_Neural_Network/Autonomous+driving+application+-+Car+detection+-+v1.ipynb | mit | import argparse
import os
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
import scipy.io
import scipy.misc
import numpy as np
import pandas as pd
import PIL
import tensorflow as tf
from keras import backend as K
from keras.layers import Input, Lambda, Conv2D
from keras.models import load_model, Mo... |
emalgorithm/Algorithm_Notebooks | ShortestPath/Shortest Path Problem.ipynb | gpl-3.0 | import math
import numpy as np
from graphviz import Digraph
import queue
# so our plots get drawn in the notebook
%matplotlib inline
from matplotlib import pyplot as plt
from random import randint
from time import clock
"""
Explanation: Shortest Path Problem
Imports
End of explanation
"""
# A timer - runs the provid... |
mmadsen/experiment-seriation-classification | analysis/sc-1/sc-1-seriation-classification-analysis.ipynb | apache-2.0 | import numpy as np
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import cPickle as pickle
from copy import deepcopy
from sklearn.metrics import classification_report, accuracy_score, confusion_matrix
train_graphs = pickle.load(open("train-freq-graphs... |
fionapigott/Data-Science-45min-Intros | k-means-101/K-means-Clustering.ipynb | unlicense | # Import some python libraries that we'll need
import matplotlib.pyplot as plt
import random
import math
import sys
%matplotlib inline
def make_data(n_points, n_clusters=2, dim=2, sigma=1):
x = [[] for i in range(dim)]
for i in range(n_clusters):
for d in range(dim):
x[d].extend([random.gau... |
mayank-johri/LearnSeleniumUsingPython | Section 1 - Core Python/Chapter 11 - Exceptions/Chapter13_Exceptions.ipynb | gpl-3.0 | print (10/0)
"""
Explanation: Chapter 13: Exceptions
When a failure occurs in the program (such as division by zero, for example) at runtime, an exception is generated. If the exception is not handled, it will be propagated through function calls to the main program module, interrupting execution.
End of explanation
... |
tBuLi/symfit | docs/examples/ex_mexican_hat.ipynb | mit | from symfit import Parameter, Variable, Model, Fit, solve, diff, N, re
from symfit.core.minimizers import DifferentialEvolution, BFGS
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Global minimization: Skewed Mexican hat
In this example we will demonstrate the ease of performing global minimizati... |
PhonologicalCorpusTools/PolyglotDB | examples/tutorial/tutorial_1_first_steps.ipynb | mit | from polyglotdb import CorpusContext
import polyglotdb.io as pgio
corpus_root = '/mnt/e/Data/pg_tutorial'
"""
Explanation: Tutorial 1: First steps
Downloading the tutorial corpus
The tutorial corpus used here is a version of the LibriSpeech test-clean subset, forced aligned with the
Montreal Forced Aligner (tutorial ... |
landlab/landlab | notebooks/tutorials/hillslope_geomorphology/taylor_diffuser/taylor_diffuser.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from landlab import RasterModelGrid
from landlab.components import TaylorNonLinearDiffuser
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_header.png"></a>
Component Overview: TaylorNonLinearDiffuser
<hr>
<small>For m... |
makism/dyfunconn | tutorials/EEG - 4 - Dynamic Connectivity (Group Analysis).ipynb | bsd-3-clause | import numpy as np
import tqdm
raw_eeg_eyes_open = np.load("data/eeg_eyes_opened.npy")
raw_eeg_eyes_closed = np.load("data/eeg_eyes_closed.npy")
num_trials, num_channels, num_samples = np.shape(raw_eeg_eyes_open)
read_trials = 10
eeg_eyes_open = raw_eeg_eyes_open[0:read_trials, ...]
eeg_eyes_closed = raw_eeg_eyes_c... |
JeffAbrahamson/MLWeek | practicum/04_features/tokenizing.ipynb | gpl-3.0 | from sklearn.feature_extraction.text import CountVectorizer
corpus = [
"Il est nuit. La cabane est pauvre, mais bien close.",
"Le logis est plein d'ombre et l'on sent quelque chose",
"Qui rayonne à travers ce crépuscule obscur.",
"Des filets de pêcheur sont accrochés au mur.",
"Au fond, dans l'enco... |
mne-tools/mne-tools.github.io | 0.19/_downloads/2fc30e4810d35d643811cc11759b3b9a/plot_resample.ipynb | bsd-3-clause | # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
#
# License: BSD (3-clause)
from matplotlib import pyplot as plt
import mne
from mne.datasets import sample
"""
Explanation: Resampling data
When performing experiments where timing is critical, a signal with a high
sampling rate is desired. However, having a sign... |
tpin3694/tpin3694.github.io | python/seaborn_pandas_timeseries_plot.ipynb | mit | import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
data = {'date': ['2014-05-01 18:47:05.069722', '2014-05-01 18:47:05.119994', '2014-05-02 18:47:05.178768', '2014-05-02 18:47:05.230071', '2014-05-02 18:47:05.230071', '2014-05-02 18:47:05.280592', '2014-05-03 18:47:05.332662',... |
adityaka/misc_scripts | python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/02_01/Final/.ipynb_checkpoints/Object Creation-checkpoint.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
"""
Explanation: Rapid Overview
build intuition about pandas
details later
documentation: http://pandas.pydata.org/pandas-docs/stable/10min.html
End of explanation
"""
my_series = pd.Series([1,3,5,np.nan,6,8])
my_series
"""
Explanation: Basic series; default integer index
do... |
MetabolicEngineeringGroupCBMA/Cunha_et_al_2017 | notebooks/pMEC9001-2-3.ipynb | bsd-3-clause | from pydna.parsers import parse_primers
p1,p2 = parse_primers('''
>P1
TTATCTTCATCACCGCCATAC
>P2
ACAAGAGAAACTTTTGGGTAAAATG
''')
"""
Explanation: Construction of the pMEC9001, 2 and 3 vectors
The vector pMEC1049 vector was used in Romaní et al. 2014 The pMEC1049 expresses a D-xylose metabolic pathway and has a hygromyc... |
ampl/amplpy | notebooks/quickstart.ipynb | bsd-3-clause | !pip install -q amplpy ampltools pandas bokeh
"""
Explanation: AMPLPY: Setup & Quick Start
Documentation: http://amplpy.readthedocs.io
GitHub Repository: https://github.com/ampl/amplpy
PyPI Repository: https://pypi.python.org/pypi/amplpy
Jupyter Notebooks: https://github.com/ampl/amplpy/tree/master/notebooks
Setup
I... |
jmhsi/justin_tinker | data_science/courses/temp/courses/dl1/lesson5-movielens.ipynb | apache-2.0 | %reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.learner import *
from fastai.column_data import *
"""
Explanation: Movielens
End of explanation
"""
path='data/ml-latest-small/'
"""
Explanation: Data available from http://files.grouplens.org/datasets/movielens/ml-latest-small.zip
End of explanat... |
goldmanm/tools | cookbook.ipynb | mit | import cantera_tools as ctt
import numpy as np
from scipy import integrate
import cantera as ct
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Cookbook-for-cantera_tools-module" data-toc-modified-id="Cookbook-for-cantera... |
AllenDowney/ModSimPy | soln/chap17soln.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... |
jhonatancasale/graduation-pool | disciplines/SME0819 - Matrices for Applied Statistics/0x00_Fundamentals/Matrices - Fundamentals.ipynb | apache-2.0 | import numpy as np # for array, dot and so on
"""
Explanation: Fundamentos de Matrizes | Matrix Fundamentals:
Uma forma organizada de representar os dados numéricos.
O tamanho ou a dimensão da matriz (nro linhas) X (nro colunas), por exemplo $2x3$
O elemento que ocupa a i-ésima linha e a j-ésima coluna é denotado por... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_tensorflow/b_estimator.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.6
import tensorflow as tf
import pandas as pd
import numpy as np
import shutil
print(tf.__version__)
"""
Explanation: <h1>2b. Machine Learning using tf.estimator... |
aleph314/K2 | Foundations/Python CS/Activity 07.ipynb | gpl-3.0 | n = 1000000
x = np.random.rand(n)
y = np.random.rand(n)
%time z = x + y
"""
Explanation: Exercise 07.1 (indexing and timing)
Create two very long NumPy arrays x and y and sum the arrays using:
The NumPy addition syntax, z = x + y; and
A for loop that computes the sum entry-by-entry
Compare the time required for the... |
hpi-epic/pricewars-merchant | docs/Building a merchant using PricewarsMerchant.ipynb | mit | import sys
sys.path.append('../')
"""
Explanation: PricewarsMerchant
A fast way to build your own merchant is to subclass the PricewarsMerchant and build your own functionality on top of it.
PricewarsMerchant is an abstract base class that implements most tasks of a merchant.
It also provides a server component that p... |
probml/pyprobml | notebooks/book1/15/entailment_attention_mlp_torch.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import math
from IPython import display
try:
import torch
except ModuleNotFoundError:
%pip install -qq torch
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils import data
import collections
import re
import random
imp... |
ireapps/cfj-2017 | completed/12. Web scraping (Part 2).ipynb | mit | from bs4 import BeautifulSoup
import csv
"""
Explanation: Let's scrape a practice table
The latest Mountain Goats album is called Goths. (It's good!) I made a simple HTML table with the track listing -- let's scrape it into a CSV.
Import the modules we'll need
End of explanation
"""
# in a with block, open the HTML ... |
GoogleCloudPlatform/cloudml-samples | notebooks/xgboost/HyperparameterTuningWithXGBoostInCMLE.ipynb | apache-2.0 | # Replace <PROJECT_ID> and <BUCKET_ID> with proper Project and Bucket ID's:
%env PROJECT_ID <PROJECT_ID>
%env BUCKET_ID <BUCKET_ID>
%env JOB_DIR gs://<BUCKET_ID>/xgboost_job_dir
%env REGION us-central1
%env TRAINER_PACKAGE_PATH ./auto_mpg_hp_tuning
%env MAIN_TRAINER_MODULE auto_mpg_hp_tuning.train
%env RUNTIME_VERSION ... |
J535D165/recordlinkage | docs/guides/link_two_dataframes.ipynb | bsd-3-clause | import recordlinkage
from recordlinkage.datasets import load_febrl4
"""
Explanation: Link two datasets
Introduction
This example shows how two datasets with data about persons can be
linked. We will try to link the data based on attributes like first
name, surname, sex, date of birth, place and address. The data used ... |
gVallverdu/cookbook | mpl_seaborn_styles.ipynb | gpl-2.0 | import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
seaborn_style = [style for style in matplotlib.style.available if "seaborn" in style]
seaborn_style
"""
Explanation: Seaborn style in matplotlib
Gemain Salvato-Vallverdu germain.vallverdu@univ-pau.fr
Matplotlib provides several styles in oder to prod... |
shareactorIO/pipeline | source.ml/jupyterhub.ml/notebooks/zz_old/TensorFlow/HvassLabsTutorials/08_Transfer_Learning.ipynb | apache-2.0 | from IPython.display import Image, display
Image('images/08_transfer_learning_flowchart.png')
"""
Explanation: TensorFlow Tutorial #08
Transfer Learning
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTube
Introduction
We saw in the previous Tutorial #07 how to use the pre-trained Inception model for classifying... |
AISpace2/AISpace2 | notebooks/search/search.ipynb | gpl-3.0 | # Run this to import pre-defined problems
from aipython.searchProblem import search_simple1, search_simple2, search_cyclic_delivery, search_acyclic_delivery, search_tree, search_extended_tree, search_cyclic, search_vancouver_neighbour, search_misleading_heuristic, search_multiple_path_pruning, search_module_4_graph, se... |
jorgedominguezchavez/dlnd_first_neural_network | 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 co... |
ucsd-ccbb/jupyter-genomics | notebooks/tcrSeq/TCR-seq.ipynb | mit | !perl demultiplex_fastq_TCRplates.pl Sample_S1_L001_R1_001.fastq Sample_S1_L001_R2_001.fastq
!ls *[A,B].fastq
"""
Explanation: TCR-seq protocol
By Roman Sasik (rsasik@ucsd.edu)
This Notebook describes the sequence of commands used in TCR-seq analysis.
The multiplexing barcodes are assumed to follow the design descr... |
crystalzhaizhai/cs207_yi_zhai | homeworks/HW6/HW6_P1_AnswerKey.ipynb | mit | from enum import Enum
class AccountType(Enum):
SAVINGS = 1
CHECKING = 2
"""
Explanation: Problem 1: Bank Account Revisited
We are going to rewrite the bank account closure problem we had a few assignments ago, only this time developing a formal class for a Bank User and Bank Account to use in our closure (reca... |
therealAJ/python-sandbox | data-science/learning/ud1/DataScience/MatPlotLib.ipynb | gpl-3.0 | %matplotlib inline
from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(-3, 3, 0.001)
plt.plot(x, norm.pdf(x))
plt.show()
"""
Explanation: MatPlotLib Basics
Draw a line graph
End of explanation
"""
plt.plot(x, norm.pdf(x))
plt.plot(x, norm.pdf(x, 1.0, 0.5))
plt.show()
"""... |
palrogg/foundations-homework | 08/Homework8-passengers.ipynb | mit | print("Q1: Which Swiss railway station is the most frequented?")
print("A: The most frequented station is Zürich HB:")
df[['Station', 'DTV']].sort_values(by='DTV', ascending=False).head(1)
print("Q2: Which stations have a higher average daily circulation on Saturday and Sunday?")
print("A: These 21 stations:")
df[df['... |
tensorflow/docs-l10n | site/en-snapshot/probability/examples/Factorial_Mixture.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
deepfield/ibis | docs/source/notebooks/tutorial/1-Intro-and-Setup.ipynb | apache-2.0 | import ibis
import os
"""
Explanation: Impala/HDFS intro and Setup
Getting started
You're going to want to make sure you can import ibis
End of explanation
"""
hdfs_port = os.environ.get('IBIS_WEBHDFS_PORT', 50070)
hdfs = ibis.hdfs_connect(host='quickstart.cloudera', port=hdfs_port)
"""
Explanation: If you have Web... |
IST256/learn-python | content/lessons/01-Intro/LAB-Intro.ipynb | mit | your_name = input("What is your name? ")
print('Hello there',your_name)
"""
Explanation: Class Coding Lab: Introduction to Programming
The goals of this lab are to help you to understand:
How to turn in your lab and homework
the Jupyter programming environments
basic Python Syntax
variables and their use
how to seque... |
cosmodesi/desibgsdev | Redshift_Efficiency_Study/BGS_z-efficiency_uniform-sampling.ipynb | bsd-3-clause | import os
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from astropy.table import Table, vstack
from astropy.io import fits
from desispec.io.util import write_bintable
from desiutil.log import get_logger, DEBUG
log = get_logger()
from desitarget.cuts import isBGS_bright, is... |
CarlosGrohmann/hypsometric | hypsometric_analysis.ipynb | mit | import sys, os
import numpy as np
import math as math
import numpy.ma as ma
from matplotlib import cm
from matplotlib.colors import LightSource
from scipy import ndimage
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
%matplotlib inline
# import osgeo libs after basemap, so it
# won't cause co... |
henchc/Rediscovering-Text-as-Data | 10-Metadata/03-Bonus-Moretti/03-Metadata.ipynb | mit | %pylab inline
from datascience import *
metadata_tb = Table.read_table("fiction_metadata.csv")
metadata_tb
# Remove rows that contain duplicate titles
# Sets are specially designed to handle unique elements and check for duplicates efficiently
titles = set()
indexes = []
for i in range(len(metadata_tb['title'])):
... |
mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.02 - XML/Working with xml - Reading.ipynb | gpl-3.0 | from lxml import etree
"""
Explanation: 1. Working with xml : reading
1.1 Introduction
Extensible Markup Language (XML) is a simple, very flexible text format derived from SGML (ISO 8879). Originally designed to meet the challenges of large-scale electronic publishing, XML is also playing an increasingly important rol... |
owlas/magpy | docs/source/notebooks/.archive/magpy-equilibrium-tests-fix-combine0.ipynb | bsd-3-clause | import numpy as np
# dipole interaction energy
def dd(t1, t2, p1, p2, nu):
return -nu*(2*np.cos(t1)*np.cos(t2) - np.sin(t1)*np.sin(t2)*np.cos(p1-p2))
# anisotropy energy
def anis(t1, t2, sigma):
return sigma*(np.sin(t1)**2 + np.sin(t2)**2)
# total energy
def tot(t1, t2, p1, p2, nu, sigma):
return dd(t1, ... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/how_google_does_ml/inclusive_ml/solution/inclusive_ml_solution.ipynb | apache-2.0 | import os
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import witwidget
from witwidget.notebook.visualization import (
WitWidget,
WitConfigBuilder,
)
pd.options.display.max_columns = 50
"""
Explanation: Inclusive ML - Understanding Bias
Learning Objectives
Invoke t... |
phoebe-project/phoebe2-docs | 2.1/tutorials/constraints.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Constraints
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
import phoebe
from phoebe im... |
rebeccabilbro/titanic | titanic_wrangling.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import pandas.io.sql as pd_sql
import sqlite3 as sql
%matplotlib inline
"""
Explanation: TITANIC: Wrangling the Passenger Manifest
Exploratory Analysis with Pandas
This tutorial is based on the Kaggle Competition,
"Predicting Survival Aboard the T... |
slundberg/shap | notebooks/benchmark/text/Machine Translation Benchmark Demo.ipynb | mit | import numpy as np
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import nlp
import shap
import shap.benchmark as benchmark
import torch
"""
Explanation: Text Data Explanation Benchmarking: Machine Translation
This notebook demonstrates how to use the benchmark utility to benchmark the performance of ... |
james-prior/cohpy | 20170720-dojo-primes-revisited.ipynb | mit | from itertools import islice, count
known_good_primes = [2, 3, 5, 7, 11, 13, 17,19, 23, 29]
def check():
assert list(islice(gen_primes(), len(known_good_primes))) == known_good_primes
def gen_primes(start=2):
for p in count(start):
for divisor in range(2, p):
if p % divisor == 0:
... |
statkraft/shyft-doc | notebooks/nea-example/run_nea_nidelva.ipynb | lgpl-3.0 | # Pure python modules and jupyter notebook functionality
# first you should import the third-party python modules which you'll use later on
# the first line enables that figures are shown inline, directly in the notebook
%pylab inline
import os
import datetime as dt
import pandas as pd
from os import path
import sys
fr... |
saashimi/code_guild | interactive-coding-challenges/sorting_searching/quick_sort/quick_sort_solution.ipynb | mit | from __future__ import division
def quick_sort(data):
if len(data) < 2:
return data
left = []
right = []
pivot_index = len(data) // 2
pivot_value = data[pivot_index]
# Build the left and right partitions
for i in range(0, len(data)):
if i == pivot_index:
contin... |
rojassergio/Aprendiendo-a-programar-en-Python-con-mi-computador | Instalando_python.ipynb | mit | from IPython.display import HTML
HTML('<iframe src=https://www.continuum.io/downloads/?useformat=mobile width=700 height=350></iframe>')
"""
Explanation: <center><font color=red> Instalando Python: un breve tutorial </font></center>
Sergio Rojas<br>
Departamento de Física, Universidad Simón Bol&iac... |
fedor1113/LineCodes | Decoder.ipynb | mit | # Makes sure to install PyPNG image handling module
import sys
!{sys.executable} -m pip install pypng
import png
r = png.Reader("ex.png")
t = r.asRGB()
img = list(t[2])
# print(img)
"""
Explanation: Decode line codes in png graphs
Assumptions (format):
The clock is given and it is a red line on the top.
The signal... |
pgmpy/pgmpy | examples/Learning Parameters in Discrete Bayesian Networks.ipynb | mit | # Use the alarm model to generate data from it.
from pgmpy.utils import get_example_model
from pgmpy.sampling import BayesianModelSampling
alarm_model = get_example_model("alarm")
samples = BayesianModelSampling(alarm_model).forward_sample(size=int(1e5))
samples.head()
"""
Explanation: Parameter Learning in Discrete... |
usantamaria/iwi131 | ipynb/25a-C3_2015_S1/Certamen3_2015_S1_CC.ipynb | cc0-1.0 | def empresas(post):
emp.append(e)
arch_P.close()
for li in arch_P:
r, p, e = li.strip().split('#')
if e not in emp:
arch_P = open(post)
emp = list()
return emp
# Solucion Ordenada
def empresas(post):
arch_P = open(post)
emp = list()
for li in arch_P:
r, p, e = li.strip().split('#')
if e not... |
infilect/ml-course1 | keras-notebooks/CNN/6.4-sequence-processing-with-convnets.ipynb | mit | from keras.datasets import imdb
from keras.preprocessing import sequence
max_features = 10000 # number of words to consider as features
max_len = 500 # cut texts after this number of words (among top max_features most common words)
print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_w... |
dmolina/es_intro_python | 03-Semantics-Variables.ipynb | gpl-3.0 | x = 1 # x is an integer
x = 'hello' # now x is a string
x = [1, 2, 3] # now x is a list
"""
Explanation: <!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="fig/cover-small.jpg">
This notebook contains an excerpt from the Whirlwind Tour of Python by Jake VanderPlas; the content is avai... |
mne-tools/mne-tools.github.io | 0.17/_downloads/f294e4a296e7fedb40bec791d9e234e9/plot_stats_cluster_1samp_test_time_frequency.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.time_frequency import tfr_morlet
from mne.stats import permutation_cluster_1samp_test
from mne.datasets import sample
print(__doc__)
"""
Explanat... |
dm-wyncode/zipped-code | content/posts/philosophy/object_classes/interfaces.ipynb | mit | %%HTML
<div style="background-color:#d9edf7;color:#31708;border-color:#bce8f1;padding: 15px;margin-bottom: 20px;border: 1px; border-radius:4px;">
<strong>psittacism: </strong> <p>automatic speech without thought of the meaning of the words spoken</p>
<p>New Latin psittacismus, from Latin psittacus parrot... |
icoxfog417/gensim_notebook | topic_model_evaluation.ipynb | mit | # enable showing matplotlib image inline
%matplotlib inline
# autoreload module
%load_ext autoreload
%autoreload 2
PROJECT_ROOT = "/"
def load_local_package():
import os
import sys
root = os.path.join(os.getcwd(), "./")
sys.path.append(root) # load project root
return root
PROJECT_ROOT = load_l... |
davofis/computational_seismology | 05_pseudospectral/fourier_acoustic_1d.ipynb | gpl-3.0 | # This is a configuration step for the exercise. Please run it before calculating the derivative!
import numpy as np
import matplotlib.pyplot as plt
from ricker import ricker
# Show the plots in the Notebook.
plt.switch_backend("nbagg")
"""
Explanation: <div style='background-image: url("../../share/images/header.sv... |
taesiri/noteobooks | rl/bc/bc.ipynb | mit | import pickle
import tensorflow as tf
import numpy as np
import tf_util
import gym
import load_policy
expert_policy_file = 'experts/Humanoid-v1.pkl'
envname = 'Humanoid-v1'
policy_fn = load_policy.load_policy(expert_policy_file)
num_rollouts = 1000
"""
Explanation: Naïve Behavioral Cloning.
First assignment of CS(1+1... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_artifacts_correction_ssp.ipynb | bsd-3-clause | import numpy as np
import mne
from mne.datasets import sample
from mne.preprocessing import compute_proj_ecg, compute_proj_eog
# getting some data ready
data_path = sample.data_path()
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = mne.io.read_raw_fif(raw_fname, preload=True, add_eeg_ref=... |
scottlittle/solar-sensors | .ipynb_checkpoints/prune-X-checkpoint.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
from data_helper_functions import *
from IPython.display import display
pd.options.display.max_columns = 999
%matplotlib inline
with np.load('data/X.npz') as data: #old X, don't use, start at "Now with all channels..."
X = data['X']
with np.load('data/Y.npz') as... |
tpin3694/tpin3694.github.io | machine-learning/load_images.ipynb | mit | # Load library
import cv2
import numpy as np
from matplotlib import pyplot as plt
"""
Explanation: Title: Load Images
Slug: load_images
Summary: How to load images using OpenCV in Python.
Date: 2017-09-11 12:00
Category: Machine Learning
Tags: Preprocessing Images
Authors: Chris Albon
Preliminaries
End of explana... |
ES-DOC/esdoc-jupyterhub | notebooks/thu/cmip6/models/sandbox-1/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'thu', 'sandbox-1', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: THU
Source ID: SANDBOX-1
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties: 3... |
eduardojvieira/Curso-Python-MEC-UCV | 3-Scipy.ipynb | mit | # ¿qué hace esta línea? La respuesta mas adelante
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import Image
"""
Explanation: <table width="100%" border="0">
<tr>
<td><img src="./images/ing.png" alt="" align="left" /></td>
<td><img src="./images/ucv.png" alt="" align="center" height... |
Santana9937/language-translation | dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
blue-yonder/tsfresh | notebooks/examples/04 Multiclass Selection Example.ipynb | mit | %matplotlib inline
import matplotlib.pylab as plt
from tsfresh import extract_features, extract_relevant_features, select_features
from tsfresh.utilities.dataframe_functions import impute
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import c... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/cmcc-cm2-sr5/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-cm2-sr5', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-CM2-SR5
Sub-Topics: Radiative Forcings.
Properties: 8... |
guyhoffman/hri-statistics | notebooks/DSUR - 04.ipynb | mit | facebookdata = pd.read_table('../../DSUR/04/FacebookNarcissism.dat')
facebookdata.head(10)
sns.lmplot(data=facebookdata, x="NPQC_R_Total", y="Rating", fit_reg=False)
sns.lmplot(data=facebookdata, x="NPQC_R_Total", y="Rating", col="Rating_Type", y_jitter=.25,fit_reg=False)
sns.lmplot(data=facebookdata, x="NPQC_R_Tot... |
MarsUniversity/ece387 | website/block_3_vision/lsn15/misc.ipynb | mit | %matplotlib inline
from __future__ import print_function
from __future__ import division
import cv2 # opencv itself
import numpy as np # matrix manipulations
from matplotlib import pyplot as plt # this lets you draw inline pictures in the notebooks
import pylab # t... |
timgasser/bcycle-austin | notebooks/bcycle_stations.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import folium
import seaborn as sns
from bcycle_lib.utils import *
%matplotlib inline
# for auto-reloading external modules
# see http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython
%load_ext autoreload
%autoreload 2
# Lo... |
ES-DOC/esdoc-jupyterhub | notebooks/messy-consortium/cmip6/models/emac-2-53-aerchem/toplevel.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'messy-consortium', 'emac-2-53-aerchem', 'toplevel')
"""
Explanation: ES-DOC CMIP6 Model Properties - Toplevel
MIP Era: CMIP6
Institute: MESSY-CONSORTIUM
Source ID: EMAC-2-53-AERCHEM
Sub-Topics: ... |
spacy-io/thinc | examples/03_textcat_basic_neural_bow.ipynb | mit | !pip install thinc syntok "ml_datasets>=0.2.0a0" tqdm
"""
Explanation: Basic neural bag-of-words text classifier with Thinc
This notebook shows how to implement a simple neural text classification model in Thinc. Last tested with thinc==8.0.0a9.
End of explanation
"""
from syntok.tokenizer import Tokenizer
def toke... |
brian-rose/ClimateModeling_courseware | Lectures/Lecture21 -- Ice albedo feedback in the EBM.ipynb | mit | # Ensure compatibility with Python 2 and 3
from __future__ import print_function, division
"""
Explanation: ATM 623: Climate Modeling
Brian E. J. Rose, University at Albany
Lecture 21: Ice albedo feedback in the EBM
Warning: content out of date and not maintained
You really should be looking at The Climate Laboratory... |
gaoshuming/udacity | tutorials/sentiment-rnn/Sentiment_RNN_Solution.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... |
kingb12/languagemodelRNN | model_comparisons/noing10_LSTM_v_BOW.ipynb | mit | report_files = ["/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_200_512_04drb/encdec_noing10_200_512_04drb.json", "/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing10_bow_200_512_04drb/encdec_noing10_bow_200_512_04drb.json"]
log_files = ["/Users/bking/IdeaProjects/... |
publicityreform/findbyimage | notebooks/sketch-rnn/sketch_rnn-updated.ipynb | gpl-3.0 | # import the required libraries
import numpy as np
import time
import random
import cPickle
import codecs
import collections
import os
import math
import json
import tensorflow as tf
from six.moves import xrange
# libraries required for visualisation:
from IPython.display import SVG, display
import svgwrite # conda in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.