repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
hankcs/HanLP | plugins/hanlp_demo/hanlp_demo/zh/tst_restful.ipynb | apache-2.0 | !pip install hanlp_restful -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/tst_restful.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.s... |
felipessalvatore/CNNexample | src/tutorials/notMNIST.ipynb | mit | import os
import sys
import tensorflow as tf
import inspect
import matplotlib.pyplot as plt
import numpy as np
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
from util import get_data_4d, plot9images,randomize... |
JoseGuzman/myIPythonNotebooks | MachineLearning/K-means_clustering.ipynb | gpl-2.0 | %pylab inline
# generate some data
def create_cluster(npoints, n_clusters):
"""
create clustered data
Arguments:
ncluster -- (int) number of clusters
npoints -- (int) number of data points in every cluster
Returns a 2D NumPy array of shape npoints, 2
"""
np.random.seed(10)
... |
KIPAC/StatisticalMethods | tutorials/gaussians.ipynb | gpl-2.0 | exec(open('tbc.py').read()) # define TBC and TBC_above
import numpy as np
import scipy.stats as st
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: Tutorial: Gaussians and Least Squares
So far in the notes and problems, we've mostly avoided one of the most c... |
totalgood/twip | docs/notebooks/03 Data -- Getting Selective.ipynb | mit | GB = 8 * (100 * 1000 * len(tfdf)) / 1.e9
GB
tfdf
"""
Explanation: If you try to allocate a 16k word by 100k document DataFrame of 64-bit integers, you'll get a memory error on a 16 GB laptop.
Later we'll learn about "constant RAM" tools that can handle an unlimitted stream of documents with a large (1M word) vocabula... |
Neurosim-lab/netpyne | netpyne/tutorials/voltage_movie_tut/voltage_movie_tut.ipynb | mit | import urllib.request
urllib.request.urlretrieve('https://raw.githubusercontent.com/Neurosim-lab/netpyne/development/doc/source/code/BS0284.swc', 'BS0284.swc')
"""
Explanation: Making a movie of voltage activity
We'll create a simple network made up of one imported morphology.
First we need to download the morphology.... |
undercertainty/ou_nlp | semeval_experiments/Building a dataframe from a core file.ipynb | apache-2.0 | filename='semeval2013-task7/semeval2013-Task7-5way/beetle/train/Core/FaultFinding-BULB_C_VOLTAGE_EXPLAIN_WHY1.xml'
import pandas as pd
from xml.etree import ElementTree as ET
tree=ET.parse(filename)
"""
Explanation: A simple (ie. no error checking or sensible engineering) notebook to extract the student answer data... |
fastai/course-v3 | zh-nbs/Lesson3_imdb.ipynb | apache-2.0 | %reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.text import *
"""
Explanation: Practical Deep Learning for Coders, v3
Lesson3_imdb
IMDB影评数据
End of explanation
"""
path = untar_data(URLs.IMDB_SAMPLE)
path.ls()
"""
Explanation: Preparing the data 准备数据
First let's download the dataset we are going... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/01_bigquery/b_bqml.ipynb | apache-2.0 | PROJECT = "cloud-training-demos" # Replace with your PROJECT
REGION = "us-central1" # Choose an available region for Cloud MLE
import os
os.environ["PROJECT"] = PROJECT
os.environ["REGION"] = REGION
!pip freeze | grep google-cloud-bigquery==1.21.0 || pip install google-cloud-bigquery==1.21.0
%load_ext go... |
agile-geoscience/xlines | notebooks/03_AVO_plot.ipynb | apache-2.0 | import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: x lines of Python
Amplitude-vs-offset plot
This notebook accompanies a blog post at Agile*.
In the first x lines we made a 2D synthetic seismogram. A major simplification in that model was normal incidence at 0 degrees of offset: the ray of seismic en... |
calee0219/Course | DM/DataMining/hw1.ipynb | mit | import pandas as pd
import datetime
df = pd.read_csv('201707-citibike-tripdata.csv')
df.columns = ['tripduration','starttime','stoptime',\
'start_station_id','start_station_name','start_station_latitude','start_station_longitude',\
'end_station_id','end_station_name','end_station_latitude',... |
ScienceStacks/jupyter_scisheets_widget | test_notebooks/20171005_notebook_narrative_scisheets_widget.ipynb | bsd-3-clause | import json
import numpy as np
import pandas as pd
from jupyter_scisheets_widget import scisheets_widget
"""
Explanation: Demonstration of Use Case
Users can enter step by step explanations of changes made to a SciSheet in a Jupyter notebook
Load necessary packages
End of explanation
"""
import pandas_datareader... |
keras-team/keras-io | examples/vision/ipynb/knowledge_distillation.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import numpy as np
"""
Explanation: Knowledge Distillation
Author: Kenneth Borup<br>
Date created: 2020/09/01<br>
Last modified: 2020/09/01<br>
Description: Implementation of classical Knowledge Distillation.
Introduction to Know... |
mssalvador/WorkflowCleaning | notebooks/SemiSupervised Demo.ipynb | apache-2.0 | %run initilization.py
path = '/home/svanhmic/workspace/DABAI/Workflows/dist_workflow/'
packages = [path+'semisupervised.zip', path+'shared.zip', path+'cleaning.zip',
path+'examples.zip', path+'classification.zip']
for p in packages:
sc.addPyFile(p)
"""
Explanation: A tour through Semisupervised learni... |
ES-DOC/esdoc-jupyterhub | notebooks/bcc/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', 'bcc', 'sandbox-1', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: BCC
Source ID: SANDBOX-1
Topic: Landice
Sub-Topics: Glaciers, Ice.
Properties: 3... |
dimonaks/siman | tutorials/calc_barriers_subroutine.ipynb | gpl-2.0 | import sys
sys.path.extend(['/home/aksenov/Simulation_wrapper/siman'])
import header
from calc_manage import add, res
from database import write_database, read_database
from set_functions import read_vasp_sets
from calc_manage import smart_structure_read
from SSHTools import SSHTools
from project_funcs import calc_barr... |
sanjayankur31/nest-simulator | doc/userdoc/model_details/noise_generator.ipynb | gpl-2.0 | import sympy
sympy.init_printing()
x = sympy.Symbol('x')
sympy.series((1-sympy.exp(-x))/(1+sympy.exp(-x)), x)
"""
Explanation: The NEST noise_generator
Hans Ekkehard Plesser, 2015-06-25
This notebook describes how the NEST noise_generator model works and what effect it has on model neurons.
NEST needs to be in your PY... |
mne-tools/mne-tools.github.io | 0.23/_downloads/ead9220acec394667b95e490359e08e7/70_point_spread.ipynb | bsd-3-clause | import os.path as op
import numpy as np
import mne
from mne.datasets import sample
from mne.minimum_norm import read_inverse_operator, apply_inverse
from mne.simulation import simulate_stc, simulate_evoked
"""
Explanation: Corrupt known signal with point spread
The aim of this tutorial is to demonstrate how to put ... |
superbobry/pymc3 | pymc3/examples/rugby_analytics.ipynb | apache-2.0 | !date
import numpy as np
import pandas as pd
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
%matplotlib inline
import pymc3 as pm, theano.tensor as tt
"""
Explanation: A Hierarchical model for Rugby prediction
@Author: Peadar Coyle
@email: peadarcoyle@googlemail.com
@date: 31/... |
GoogleCloudPlatform/training-data-analyst | quests/dei/xgboost_caip_e2e.ipynb | apache-2.0 | #You'll need to install XGBoost on the TF instance
!pip3 install xgboost==0.90 witwidget --user --quiet
"""
Explanation: Cloud AI Platform + What-if Tool: end-to-end XGBoost example
This notebook shows how to:
* Build a binary classification model with XGBoost trained on a mortgage dataset
* Deploy the model to Cloud... |
gururajl/deep-learning | 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... |
lcharleux/numerical_analysis | doc/ODE/ODE_harmonic_oscillator.ipynb | gpl-2.0 | # Setup
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# Setup
f0 = 1.
omega0 = 2. * np.pi * f0
a = 1.
"""
Explanation: Ordinary Differential Equations : Practical work on the harmonic oscillator
In this example, you will simulate an harmonic oscillat... |
Diyago/Machine-Learning-scripts | statistics/stat.bootstrap_intervals.ipynb | apache-2.0 | import numpy as np
import pandas as pd
%pylab inline
"""
Explanation: Доверительные интервалы на основе bootstrap
End of explanation
"""
data = pd.read_csv('verizon.txt', sep='\t')
data.shape
data.head()
data.Group.value_counts()
pylab.figure(figsize(12, 5))
pylab.subplot(1,2,1)
pylab.hist(data[data.Group == 'IL... |
braemy/mentor-mentee-recommender-system | 2.Topics.ipynb | mit | #Uncomment this cell if you don't have the data on your computer
#nltk.download("stopwords")
#nltk.download("wordnet")
"""
Explanation: Preprocessing
For the topic extraction part we will use the dictionary of author->list_of_publications collected in the previous step. We need to do some preprocessing first
We use t... |
mit-crpg/openmc | examples/jupyter/nuclear-data.ipynb | mit | %matplotlib inline
import os
from pprint import pprint
import shutil
import subprocess
import urllib.request
import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm
from matplotlib.patches import Rectangle
import openmc.data
"""
Explanation: Nuclear Data
In this notebook, we will go throu... |
jalabort/templatetracker | notebooks/CF Tracker.ipynb | bsd-3-clause | video_path = '../data/video.mp4'
cam = cv2.VideoCapture(video_path)
print 'Is video capture opened?', cam.isOpened()
n_frames = 500
resolution = (640, 360)
frames = []
for _ in range(n_frames):
# read frame
frame = cam.read()[1]
# scale down
frame = cv2.resize(frame, resolution)
# bgr to rgb
... |
pfschus/fission_bicorrelation | methods/detector_pair_angles.ipynb | mit | %%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')
"""
Explanation: <h1 id="tocheading">Table of Contents</h1>
<div id="toc"></div>
End of explanation
"""
# Import packages
import os.path
import time
import numpy as np
np.set_printoptions(threshold=np.nan) # prin... |
ueapy/ueapy.github.io | content/notebooks/2016-01-22-string-formatting.ipynb | mit | header_text = '{!-*- F90 -*-}'
with open('header.inp','w') as header_file:
header_file.write(header_text)
"""
Explanation: Sometimes in order to run some programming software we need to prepare an input description file which specifies the model setup (e.g., chemical mechanism, intergration method, desired type of... |
madsenmj/ml-introduction-course | Class09/Class09.ipynb | apache-2.0 | import pandas as pd
import matplotlib.pyplot as plt
df1=pd.read_csv('Class09_cluster_example1.csv',index_col=0)
df1.head()
"""
Explanation: Class 09
ML Models: Clustering
We continue working with unsupervised learning in this class. This time we are interested in separating out groups of data or creating clusters. Th... |
goodwordalchemy/thinkstats_notes_and_exercises | code/chap03ex.ipynb | gpl-3.0 | %matplotlib inline
import thinkstats2
import thinkplot
import chap01soln
resp = chap01soln.ReadFemResp()
print len(resp)
"""
Explanation: Exercise from Think Stats, 2nd Edition (thinkstats2.com)<br>
Allen Downey
Read the female respondent file.
End of explanation
"""
numkdhh = thinkstats2.Pmf(resp.numkdhh)
numkdhh
... |
sdpython/pyquickhelper | _unittests/ut_helpgen/data_gallery/notebooks/exams/interro_rapide_20_minutes_2014_12.ipynb | mit | from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: Correction de l'interrogation écrite du 14 novembre 2014
End of explanation
"""
def make_squares(n):
squares = [i**2 for i in range(n)]
"""
Explanation: Enoncé 1
Q1
Le code suivant produit une erreur. Laquelle ?
End of explanation
... |
nikbearbrown/Deep_Learning | NEU/Guowei_Yang_DL/Tensorflow Tutorial_1_GY.ipynb | mit | import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import confusion_matrix
"""
Explanation: TensorFlow Tutorial 01
Simple Linear Model
Introduction
This tutorial demonstrates the basic workflow of TensorFlow with a simple linear model.
End of explanation
"""
from tensorfl... |
ES-DOC/esdoc-jupyterhub | notebooks/uhh/cmip6/models/sandbox-2/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'uhh', 'sandbox-2', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: UHH
Source ID: SANDBOX-2
Topic: Ocean
Sub-Topics: Timestepping Framework, Advection, ... |
Jackie789/JupyterNotebooks | MultivariableRegression_ChallengeWithCrossValidation.ipynb | gpl-3.0 | import warnings
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import linear_model
# Suppress annoying harmless error.
warnings.filterwarnings(
action="ignore"
)
data_path = "https://raw.githubusercontent.com/Thinkful-Ed/data-201-resources/master/New_Y... |
tensorflow/docs-l10n | site/ko/tutorials/keras/regression.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... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/09_sequence/sinewaves.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
!pip install --user google-cloud-bigquery==1.25.0
"""
Explanation: Time Series Prediction
Objectives
1. Build a linear, DNN and CNN model in Keras.
2. Build a simple RNN model and a multi-layer RNN model in Keras.
In this lab we will with a linear, ... |
allandieguez/teaching | Matplotlib e Seaborn/Modulo 3 - Histogramas + Box Plot.ipynb | gpl-3.0 | import numpy as np
import os
import pandas as pd
""" habilitando plots no notebook """
%matplotlib inline
""" plot libs """
import matplotlib.pyplot as plt
import seaborn as sns
""" Configurando o Matplotlib para o modo manual """
plt.interactive(False)
"""
Explanation: Módulo 3: Histogramas + Box Plot
Tutorial
Im... |
keldLundgaard/Sandbox_democracy | Sandbox_response_rate_problem.ipynb | mit | N_members = 1254
N_respondents = 100
p = 0.6
N_yes = int(N_members*p)
N_no = int(N_members*(1-p))
"""
Explanation: Intro: Reliability of survey and voting results for low response rates
I will here briefly explore how we can get around the uncertainty around community surveys and votes where we don't have full partici... |
ES-DOC/esdoc-jupyterhub | notebooks/ipsl/cmip6/models/sandbox-3/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ipsl', 'sandbox-3', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: IPSL
Source ID: SANDBOX-3
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radi... |
chungjjang80/FRETBursts | notebooks/Example - FRET histogram fitting.ipynb | gpl-2.0 | from fretbursts import *
sns = init_notebook(apionly=True)
import lmfit
print('lmfit version:', lmfit.__version__)
# Tweak here matplotlib style
import matplotlib as mpl
mpl.rcParams['font.sans-serif'].insert(0, 'Arial')
mpl.rcParams['font.size'] = 12
%config InlineBackend.figure_format = 'retina'
"""
Explanation: E... |
pxcandeias/py-notebooks | reliability.ipynb | mit | % matplotlib inline
import sys
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib as mpl
from scipy.stats import norm, lognorm
from scipy.integrate import quad
import matplotlib.pyplot as plt
print(sys.version)
for module in (np, sp, pd, mpl):
print('{:.<15}{}'.format(module.__name__, m... |
QuantEcon/QuantEcon.notebooks | rmt3_ch11.ipynb | bsd-3-clause | # imports and workspace setup
%matplotlib inline
from dolo import yaml_import, pcat
import dolo.algos.dtcscc.perfect_foresight as pf
from dolo.algos.dtcscc.steady_state import find_deterministic_equilibrium
from dolo.misc.graphs import plot_irfs
import numpy as np
import matplotlib.pyplot as plt
plt.style.use("ggplot")... |
phoebe-project/phoebe2-docs | development/examples/legacy_spots.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.4,<2.5"
"""
Explanation: Comparing Spots in PHOEBE 2 vs PHOEBE Legacy
Setup
Let's first make sure we have the latest version of PHOEBE 2.4 installed (uncomment this line if running in an online notebook session such as colab).
End of explanation
"""
import phoebe
from phoebe import u # un... |
cliburn/sta-663-2017 | scratch/Lecture10A.ipynb | mit | def in_unit_circle(x, y):
if x**2 + y**2 < 1:
return 1
else:
return 0
@numba.vectorize('int64(float64, float64)',target='cpu')
def in_unit_circle_serial(x, y):
if x**2 + y**2 < 1:
return 1
else:
return 0
@numba.vectorize('int64(float64, float64)',target='parallel')
def ... |
psychemedia/parlihacks | notebooks/Co-Occurring Tag Analysis.ipynb | mit | #Data files
!ls ../data/dataexport
"""
Explanation: Co-Occurring Tag Analysis
Analysing how tags co-occur across various Parliamentary publications. The idea behind this is to see whether there are naturally occurring groupings of topic tags by virtue of their co-occurence when used to tag different classes of Parlima... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/03_tensorflow/labs/d_traineval.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.5
from google.cloud import bigquery
import tensorflow as tf
import numpy as np
import shutil
print(tf.__version__)
"""
Explanation: <h1> 2d. Distributed training ... |
lilleswing/deepchem | examples/tutorials/04_Molecular_Fingerprints.ipynb | mit | !curl -Lo conda_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py
import conda_installer
conda_installer.install()
!/root/miniconda/bin/conda info -e
!pip install --pre deepchem
"""
Explanation: Tutorial 4: Molecular Fingerprints
Molecules can be represented in many ways... |
cathalmccabe/PYNQ | boards/Pynq-Z2/logictools/notebooks/fsm_generator.ipynb | bsd-3-clause | from pynq.overlays.logictools import LogicToolsOverlay
logictools_olay = LogicToolsOverlay('logictools.bit')
"""
Explanation: Finite State Machine Generator
This notebook will show how to use the Finite State Machine (FSM) Generator to generate a state machine. The FSM we will build is a Gray code counter. The count... |
Upward-Spiral-Science/grelliam | code/inferential_simulation.ipynb | apache-2.0 | import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import itertools
import os
import csv
import igraph as ig
%matplotlib inline
font = {'weight' : 'bold',
'size' : 14}
import matplotlib
matplotlib.rc('font', **font)
np.random.seed(123456789) # for reproducibility, set random seed
... |
dariox2/CADL | session-3/lecture-3.ipynb | apache-2.0 | # imports
%matplotlib inline
# %pylab osx
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
# Some additional libraries which we'll use just
# to produce some visualizations of our training
from libs.utils import montage
from libs i... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session14/Day2/DeeplearningSolutions.ipynb | mit | !pip install astronn
import torch
import matplotlib.pyplot as plt
import numpy as np
from sklearn.metrics import accuracy_score, confusion_matrix, ConfusionMatrixDisplay
"""
Explanation: Classification with a Multi-layer Perceptron (MLP)
Author: V. Ashley Villar
In this problem set, we will not be implementing neural ... |
CPernet/LanguageDecision | notebooks/exploratory/2017-05-17-hddm-exploration.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: Exploring hddm
End of explanation
"""
import hddm
# Load csv data - converted to numpy array
data = hddm.load_csv('../examples/hddm_simple.csv')
# Create hddm model object
model = hddm.HDDM(data, depends_on={'v': 'difficulty'})
# Markov chain Monte Carlo sampling
model.sample(2... |
probcomp/bdbcontrib | examples/satellites/querying-and-plotting.ipynb | apache-2.0 | import os
import subprocess
if not os.path.exists('satellites.bdb'):
subprocess.check_call(['curl', '-O', 'http://probcomp.csail.mit.edu/bayesdb/downloads/satellites.bdb'])
"""
Explanation: Querying a Population and Plotting the Results
Before we can query a population, we must have one. We will use a population o... |
louridas/rwa | content/notebooks/chapter_10.ipynb | bsd-2-clause | import csv
import pprint
with open('ballots.csv') as ballots_file:
reader = csv.reader(ballots_file)
ballots = list(reader)
pprint.pprint(ballots, width=30)
"""
Explanation: Voting Strengths
Chapter 10 of Real World Algorithms.
Panos Louridas<br />
Athens University of Economics and Business
The Schu... |
cloudmesh/book | notebooks/machinelearning/precisionrecall.ipynb | apache-2.0 | from sklearn import svm, datasets
from sklearn.model_selection import train_test_split
import numpy as np
"""
Explanation: Precision and Recall
In machine learning model, we have mentioned that, there is an important concept called metrics. However, for classifications problems, accuracy is one of the metrics. There a... |
kazzz24/deep-learning | 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... |
spulido99/NetworksAnalysis | DiderGonzalez/Ejercicios 1.4/Ejercicios 1.4 Power Law & Scale Free Networks.ipynb | mit | import numpy as np
from scipy.stats import powerlaw
import scipy as sp
import seaborn as sns
sns.set()
%matplotlib inline
edges =[]
for line in open('facebook_combined.txt'):
if line[0] != '#':
# print(line.replace('\n','').split(' ')) # \n es salto de linea, .split(' ') -> separar por espacio, .split('\t'... |
wegamekinglc/Finance-Python | ipynb/Presentation for Analysis.ipynb | mit | from PyFin.Math.Accumulators import Latest
exp1 = Latest('x')
exp1
"""
Explanation: Finance-Python
原始项目地址:Finance-Python(https://github.com/wegamekinglc/Finance-Python);
python setup.py install 或者,
pip install finance-python
相关依赖请见主目录下 requirements 文件夹。
Operator in Declarative Style
声明式
计算表达式被抽象为一些算子,用户无需给出计算的流... |
altair-viz/altair_parser | JSONSchemaNotes.ipynb | bsd-3-clause | import json
import jsonschema
simple_schema = {
"type": "object",
"properties": {
"foo": {"type": "string"},
"bar": {"type": "number"}
}
}
good_instance = {
"foo": "hello world",
"bar": 3.141592653,
}
bad_instance = {
"foo" : 42,
"bar" : "string"
}
# Should succeed
jsonsc... |
tedunderwood/horizon | chapter1/notebooks/chapter1figs1and2.ipynb | mit | #!/usr/bin/env python3
import csv, os, sys
from collections import Counter
# import utils
sys.path.append('../../lib')
import SonicScrewdriver as utils
import FileCabinet as filecab
# start by loading the hard seeds
colors = set()
with open('../lexicons/colors.txt', encoding = 'utf-8') as f:
for line in f:
... |
harper/dlnd_thirdproject | tv-script-generation/dlnd_tv_script_generation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
data_dir = './data/simpsons/moes_tavern_lines.txt'
text = helper.load_data(data_dir)
# Ignore notice, since we don't use it for analysing the data
text = text[81:]
"""
Explanation: TV Script Generation
In this project, you'll generate your own Simpsons TV scrip... |
ES-DOC/esdoc-jupyterhub | notebooks/mri/cmip6/models/sandbox-1/ocnbgchem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mri', 'sandbox-1', 'ocnbgchem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem
MIP Era: CMIP6
Institute: MRI
Source ID: SANDBOX-1
Topic: Ocnbgchem
Sub-Topics: Tracers.
Properties: 6... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/time_series_prediction/solutions/4_modeling_keras.ipynb | apache-2.0 | import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from google.cloud import bigquery
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import (Dense, DenseFeatures... |
ThunderShiviah/code_guild | interactive-coding-challenges/graphs_trees/tree_height/height_challenge.ipynb | mit | %run ../bst/bst.py
%load ../bst/bst.py
def height(node):
# TODO: Implement me
pass
"""
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Determine the height of a tree.
Constraints
Test Cases
Algorithm
Code
Unit Te... |
mne-tools/mne-tools.github.io | 0.24/_downloads/568aae18ec92d284aff29cfb5f3c11e7/resolution_metrics.ipynb | bsd-3-clause | # Author: Olaf Hauk <olaf.hauk@mrc-cbu.cam.ac.uk>
#
# License: BSD-3-Clause
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_resolution_matrix
from mne.minimum_norm import resolution_metrics
print(__doc__)
data_path = sample.data_path()
subjects_dir = data_path + '/subjects/'
fnam... |
pydata/xarray | doc/examples/visualization_gallery.ipynb | apache-2.0 | import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import xarray as xr
%matplotlib inline
"""
Explanation: Visualization Gallery
This notebook shows common visualization issues encountered in xarray.
End of explanation
"""
ds = xr.tutorial.load_dataset("air_temperature")
"""
Explanation: Load example datas... |
ffmmjj/intro_to_data_science_workshop | solutions/.ipynb_checkpoints/Boston housing prices prediction-checkpoint.ipynb | apache-2.0 | # Make sure you have a working installation of pandas by executing this cell
import pandas as pd
"""
Explanation: Regression problems involve the prediction of a continuous, numeric value from a set of characteristics.
In this example, we'll build a model to predict house prices from characteristics like the number of... |
metpy/MetPy | v0.9/_downloads/0fad3c70b425eaed875fe7cd5ea738b8/Advanced_Sounding.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, SkewT
from metpy.units import units
"""
Explanation: Advanced Sounding
Plot a sounding using MetPy with more advanced features.
Beyond just p... |
flyflyjean/python-ay250-homeworks | hw_2/hw_2_assignment.ipynb | mit | %matplotlib inline
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
img=mpimg.imread('problem0.png')
plt.imshow(img)
"""
Explanation: problem 0
End of explanation
"""
%matplotlib inline
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
img=mpimg.i... |
Kaggle/learntools | notebooks/data_cleaning/raw/tut4.ipynb | apache-2.0 | # modules we'll use
import pandas as pd
import numpy as np
# helpful character encoding module
import chardet
# set seed for reproducibility
np.random.seed(0)
"""
Explanation: In this notebook, we're going to be working with different character encodings.
Let's get started!
Get our environment set up
The first thin... |
IACS-CS-207/cs207-F17 | lectures/L9/L9.ipynb | mit | from IPython.display import HTML
"""
Explanation: Lecture 9
Object Oriented Programming
Monday, October 2nd 2017
End of explanation
"""
def Complex(a, b): # constructor
return (a,b)
def real(c): # method
return c[0]
def imag(c):
return c[1]
def str_complex(c):
return "{0}+{1}i".format(c[0], c[1])
... |
mne-tools/mne-tools.github.io | 0.19/_downloads/1935e973eb220e31cb4a6a6541231eb1/plot_background_statistics.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
# License: BSD (3-clause)
from functools import partial
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa, analysis:ignore
import mne
from mne.stats import (ttest_1samp_no_p, bonferroni_correctio... |
JeromeRisselin/PRJ-medtec_sigproc | SigProc_101/SigProc-101-pimped.ipynb | mit | from __future__ import print_function
import numpy as np
from PIL import Image # for bmp import
from glob import glob
from scipy.misc import imresize
import matplotlib.pyplot as plt
import math
import time
%matplotlib inline
def showImage(imageToPlot):
plt.figure(figsize=(2, 4))
plt.gray()
plt.imshow(imag... |
hvillanua/deep-learning | 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... |
desihub/desisim | doc/nb/bgs-archetypes.ipynb | bsd-3-clause | import os
import numpy as np
import matplotlib.pyplot as plt
from desispec.io.util import write_bintable, makepath
from desisim.io import write_templates
from desisim.archetypes import compute_chi2, ArcheTypes
import multiprocessing
nproc = multiprocessing.cpu_count() // 2
plt.style.use('seaborn-talk')
%matplotlib ... |
tanmay987/deepLearning | image-classification/dlnd_image_classification.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifar10... |
hpparvi/PyTransit | notebooks/example_eclipse_model.ipynb | gpl-2.0 | %pylab inline
sys.path.append('..')
from pytransit import EclipseModel
seed(0)
times_sc = linspace(0.5, 2.5, 5000) # Short cadence time stamps
times_lc = linspace(0.5, 2.5, 500) # Long cadence time stamps
k, t0, p, a, i, e, w = 0.1, 1., 2.0, 4.2, 0.5*pi, 0.25, 0.4*pi
ns = 50
ks = normal(k, 0.01, ns)
t0s = no... |
Chemcy/vnpy | vn.tutorial/performance/Performance of Receiving Tick Data.ipynb | mit | from datetime import datetime, time
import time as gtime
import pymongo
from dateutil.parser import parse
"""
Explanation: vnpy接收行情数据性能测试与改进优化
by Jerry He, 2016.12,
讨论:https://zhuanlan.zhihu.com/p/24662087
近来,量化交易平台vnpy因其开源、功能强大、开发容易、可定制性强的特点,目前已经被广泛应用在量化交易中。
行情数据落地是量化交易平台必须解决的一个基础问题,它有两个方面的作用:一是供策略开发时进行分析、回测;二是为实盘程序时... |
CAChemE/curso-python-datos | notebooks/011-NumPy-CaracteristicasArrays.ipynb | bsd-3-clause | import numpy as np
lista = [ 1, 1+2j, True, 'aerodinamica', [1, 2, 3] ]
lista
"""
Explanation: Características de los arrays de NumPy
En este notebook veremos como las principales características de los arrays de NumPy y cómo mejoran la eficiencia de nuestro código.
El objeto tipo array que proporciona NumPy (Python ... |
sytays/openanalysis | doc/Langauge/13 - Introduction to Object Oriented Programming in Python.ipynb | gpl-3.0 | class Student:
count = 0 # Total number of objects created so far, it is static variable as it is declared outside
def __init__(self,name,usn,marks):
"""
Constructor of class Student
Input: name - name of the student : string
usn - university serial number : string
... |
CORE-GATECH-GROUP/serpent-tools | examples/DepletionMatrix.ipynb | mit | %matplotlib inline
import os
mtxFile = os.path.join(
os.environ["SERPENT_TOOLS_DATA"],
"depmtx_ref.m")
"""
Explanation: Copyright (c) 2017-2020 Serpent-Tools developer team, GTRC
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ... |
DallasTrinkle/Onsager | examples/Fe-C.ipynb | mit | import sys
sys.path.extend(['../'])
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
%matplotlib inline
import onsager.crystal as crystal
import onsager.OnsagerCalc as onsager
from scipy.constants import physical_constants
kB = physical_constants['Boltzmann constant in eV/K'][0]
""... |
gpagliuca/pyfas | docs/notebooks/.ipynb_checkpoints/OLGA_ppl-checkpoint.ipynb | gpl-3.0 | ppl_path = '../../pyfas/test/test_files/'
fname = 'FC1_rev01.ppl'
ppl = fa.Ppl(ppl_path+fname)
"""
Explanation: OLGA ppl files, examples and howto
For an tpl file the following methods are available:
<b>filter_data</b> - return a filtered subset of trends
<b>extract</b> - extract a single trend variable
<b>to_excel</... |
darkomen/TFG | medidas/12082015/.ipynb_checkpoints/Análisis de datos Ensayo 1-checkpoint.ipynb | cc0-1.0 | #Importamos las librerías utilizadas
import numpy as np
import pandas as pd
import seaborn as sns
#Mostramos las versiones usadas de cada librerías
print ("Numpy v{}".format(np.__version__))
print ("Pandas v{}".format(pd.__version__))
print ("Seaborn v{}".format(sns.__version__))
#Abrimos el fichero csv con los datos... |
patrick-kidger/diffrax | examples/neural_sde.ipynb | apache-2.0 | from typing import Union
import diffrax
import equinox as eqx # https://github.com/patrick-kidger/equinox
import jax
import jax.nn as jnn
import jax.numpy as jnp
import jax.random as jrandom
import matplotlib.pyplot as plt
import optax # https://github.com/deepmind/optax
"""
Explanation: Neural SDE
This example con... |
tensorflow/examples | courses/udacity_intro_to_tensorflow_lite/tflite_c05_exercise_rock_paper_scissors.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... |
ekostat/ekostat_calculator | notebooks/lv_notebook_kustzon.ipynb | mit | root_directory = 'D:/github/w_vattenstatus/ekostat_calculator'#"../" #os.getcwd()
workspace_directory = root_directory + '/workspaces'
resource_directory = root_directory + '/resources'
#alias = 'lena'
user_id = 'test_user' #kanske ska vara off_line user?
# workspace_alias = 'lena_indicator' # kustzonsmodellen_3daydat... |
ZhangXinNan/tensorflow | tensorflow/contrib/eager/python/examples/nmt_with_attention/nmt_with_attention.ipynb | apache-2.0 | from __future__ import absolute_import, division, print_function
# Import TensorFlow >= 1.10 and enable eager execution
import tensorflow as tf
tf.enable_eager_execution()
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import unicodedata
import re
import numpy as np
import os
i... |
mathcoding/Programmazione2 | .ipynb_checkpoints/Lab 3 - Cenni di Programmazione Funzionale - Parte seconda-checkpoint.ipynb | mit | # Due modi diversi per definire la stessa funzione:
# Primo: metodo standard, funzione di nome F1
def F1(x):
return x**2
# Secondo: lambda expression a cui si assegna un nome
F2 = lambda x: x**2
F1(3.3) == F2(3.3)
(lambda x,y: x+y)(2,3)
print(type(lambda x: x**2))
"""
Explanation: Elementi a supporto della Pro... |
steinam/teacher | jup_notebooks/data-science-ipython-notebooks-master/deep-learning/deep-dream/dream.ipynb | mit | # imports and basic notebook setup
from cStringIO import StringIO
import numpy as np
import scipy.ndimage as nd
import PIL.Image
from IPython.display import clear_output, Image, display
from google.protobuf import text_format
import caffe
# If your GPU supports CUDA and Caffe was built with CUDA support,
# uncomment ... |
hglanz/phys202-2015-work | assignments/assignment03/NumpyEx04.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 4
Imports
End of explanation
"""
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
"""
Explanation: Complete graph Laplacian
In discrete mathematics a Graph is a set of vertices or n... |
bendichter/tenseflow | change_tenses.ipynb | mit | sentences = parse(text).split()
[x for x in sentences[0] if x[0] == 'thought']
"""
Explanation: Here 'thought' was not changed. Let's check if it was labeled as a noun.
End of explanation
"""
nlp = English()
doc=nlp(text)
[x for x in list(doc.sents)[0] if x.text == 'thought'][0].tag_
"""
Explanation: Yup, it's labe... |
davidrpugh/pyCollocation | examples/solow-model.ipynb | mit | def cobb_douglas_output(k, alpha, **params):
return k**alpha
"""
Explanation: <h2>Example: Solow model with Cobb-Douglas production</h2>
The Solow model is a model of economic growth as a process of physical capital accumulation. By far the most common version of the Solow model assumes Cobb-Douglas functional fo... |
ES-DOC/esdoc-jupyterhub | notebooks/awi/cmip6/models/sandbox-2/seaice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'awi', 'sandbox-2', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: AWI
Source ID: SANDBOX-2
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Radiat... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/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', 'cnrm-cerfacs', 'sandbox-1', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: SANDBOX-1
Topic: Landice
Sub-Topics: Glaciers, I... |
paolorivas/homeworkfoundations | 11/Homework_11_Paolo_Rivas.ipynb | mit | import pandas as pd
#import pandas as pd
import datetime
import datetime as dt
# import datetime
# import datetime as dt
dt.datetime.strptime('08/04/2013', '%m/%d/%Y')
datetime.datetime(2013, 8, 4, 0, 0)
parser = lambda date: pd.datetime.strptime(date, '%m/%d/%Y')
!head -n 10000 violations.csv > small-violations.cs... |
google/trax | trax/models/reformer/image_generation.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 Licen... |
LDSSA/learning-units | units/13-advanced-validation/problems/ign_problem.ipynb | mit | df = pd.read_csv("../data/ign.csv")
print(df.info())
df = df.drop('title', axis=1)
df = df.drop('url', axis=1)
df = df.drop('Unnamed: 0', axis=1)
df = df.dropna()
print(df.info())
print(df.head())
"""
Explanation: Check the data, deal with NaNs
End of explanation
"""
from sklearn import preprocessing
le = pre... |
ilivans/information-retrieval | 07_duplicates/simhash.ipynb | mit | %%time
with open("simhash_sorted.txt") as f:
simhashes = [int(line[:-1]) for line in f.readlines()]
simhashes = np.array(simhashes, dtype=np.uint64) # found out before that simhash fits uint64
SIMHASH_SIZE = 64
num_samples = len(simhashes)
print "Number of samples:", num_samples
print "SimHash example:", format(s... |
barjacks/swiss-asylum-judges | Analysing 30000 Verdicts.ipynb | mit | import re
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import glob
plt.style.use('ggplot')
import dateutil.parser
import re
import time
from collections import Counter
%matplotlib inline
"""
Explanation: Analysing the Textfiles
End of explanation
"""
whole_list_of_names =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.