repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
bi-labor/pandas_jupyter | notebooks/Pandas_alapok.ipynb | lgpl-3.0 | import pandas as pd # konvenció szerint pd aliast használunk
%matplotlib inline
import matplotlib
import numpy as np
# tegyük szebbé a grafikonokat
matplotlib.style.use('ggplot')
matplotlib.pyplot.rcParams['figure.figsize'] = (15, 3)
matplotlib.pyplot.rcParams['font.family'] = 'sans-serif'
grades = pd.DataFrame(
... |
BillyLjm/CS100.1x.__CS190.1x | lab3_text_analysis_and_entity_resolution_student.ipynb | mit | import re
DATAFILE_PATTERN = '^(.+),"(.+)",(.*),(.*),(.*)'
def removeQuotes(s):
""" Remove quotation marks from an input string
Args:
s (str): input string that might have the quote "" characters
Returns:
str: a string without the quote characters
"""
return ''.join(i for i in s if ... |
gboeing/urban-data-science | modules/03-python-data-science/lecture.ipynb | mit | import numpy as np
import pandas as pd
"""
Explanation: Python/Pandas Refresher
Overview of today's topics:
Quick Python refresher
pandas overview
Load data files
Select, filter, and slice data from a dataset
Merging and concatenating datasets
Grouping and summarizing data
Vectorization, map, and apply
Hierarchical i... |
mbuchove/notebook-wurk-b | stats/astro283_hw2.ipynb | mit | from scipy import random, optimize, std
from matplotlib import pyplot
%matplotlib inline
import numpy
import csv
"""
Explanation: <h1> Homework 2 </h1>
Matt Buchovecky
Astro 283
End of explanation
"""
sigma_meas = 1.0 # standard deviation of measurements
p_err = 0.30 # probability of experimental mistake occurring... |
kiwiPhrases/EITChousing | EITC Housing Aid Cost Estimation multi.ipynb | mit | ##Load modules and set data path:
import pandas as pd
import numpy as np
import numpy.ma as ma
import re
data_path = "C:/Users/SpiffyApple/Documents/USC/RaphaelBostic/EITChousing"
output_container = {}
#################################################################
################### load tax data #################... |
ES-DOC/esdoc-jupyterhub | notebooks/cmcc/cmip6/models/cmcc-esm2-sr5/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cmcc', 'cmcc-esm2-sr5', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CMCC
Source ID: CMCC-ESM2-SR5
Topic: Aerosol
Sub-Topics: Transport, Emission... |
mgalardini/2017_python_course | notebooks/8-image-analysis.ipynb | gpl-2.0 | # For python 2 users
from __future__ import division, print_function
# Scientific python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Image analysis
import scipy.ndimage as ndi
from skimage import io, segmentation, graph, filters, measure
# Machine learning
from sklearn import preprocess... |
tpin3694/tpin3694.github.io | machine-learning/.ipynb_checkpoints/create_a_vector-checkpoint.ipynb | mit | # Load library
import numpy as np
"""
Explanation: Title: Create A Vector
Slug: create_a_vector
Summary: How to create a vector in Python.
Date: 2017-09-02 12:00
Category: Machine Learning
Tags: Vectors Matrices Arrays
Authors: Chris Albon
Preliminaries
End of explanation
"""
# Create a vector as a row
vector... |
oblassers/fair-data-science | Task-3-Experiment.ipynb | mit | import pymongo
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import json
import re
from pymongo import MongoClient
%matplotlib inline
"""
Explanation: Data Preservation Task 3
This experiment takes a dataset about divorces per year after marrige (link: https://www.data.gv.at/katalog/dataset/7f... |
Astrohackers-TW/IANCUPythonAdventure | notebooks/notebooks4beginners/learnOOfrom_astropy_cosmology.ipynb | mit | from astropy.cosmology import WMAP9, Planck15 # 從astropy.cosmology中引入兩個內建的宇宙物件
print(WMAP9) # WMAP9是以FlatLambdaCDM類別所產生的一個內建物件
print(Planck15) # Planck15是以FlatLambdaCDM類別所產生的另一個內建物件
print(WMAP9.H0) # WMAP9物件的H0屬性
print(Planck15.Om0) # Planck15物件的Om0屬性
print(WMAP9.luminosity_distance(1.5)) ... |
karlstroetmann/Formal-Languages | Python/Minimize.ipynb | gpl-2.0 | def arb(M):
for x in M:
return x
assert False, 'Error: arb called with empty set!'
"""
Explanation: Minimizing a <span style="font-variant:small-caps;">Fsm</span>
The function arb(M) takes a non-empty set M as its argument and returns an arbitrary element from this set.
The set M is not changed.
End of... |
mfinkle/user-data-analytics | android-clients.ipynb | mit | def dedupe_pings(rdd):
return rdd.filter(lambda p: p["meta/clientId"] is not None)\
.map(lambda p: (p["meta/documentId"], p))\
.reduceByKey(lambda x, y: x)\
.map(lambda x: x[1])
"""
Explanation: Take the set of pings, make sure we have actual clientIds and remove duplicat... |
quiquinSP/pygacs | notebooks/GACS-Workshop.ipynb | lgpl-3.0 | import requests
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import time
import os
import getpass
# Directive to matblotlib for creating interactive graphs
# Use %matplotlib inline for just creating the plots
%matplotlib notebook
# Gaia Archive REST URL
gacs_url = 'https://gea.esac.esa... |
SJSlavin/phys202-2015-work | assignments/assignment03/NumpyEx02.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 2
Imports
End of explanation
"""
def np_fact(n):
"""Compute n! = n*(n-1)*...*1 using Numpy."""
#using these seperate cases seems needlessly complex, but it should work for all numbers (... |
landlab/landlab | notebooks/tutorials/terrain_analysis/chi_finder/chi_finder.ipynb | mit | import copy
import numpy as np
import matplotlib as mpl
from landlab import RasterModelGrid, imshow_grid
from landlab.io import read_esri_ascii
from landlab.components import FlowAccumulator, ChiFinder
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_header.png"></a>
U... |
snegirigens/DLND | 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... |
lknelson/text-analysis-2017 | 04-Dictionaries/01-ChiSquared_ExerciseSolutions.ipynb | bsd-3-clause | import pandas
from sklearn.feature_extraction.text import CountVectorizer
text_list = []
#open and read the novels, save them as variables
austen_string = open('../Data/Austen_PrideAndPrejudice.txt', encoding='utf-8').read()
alcott_string = open('../Data/Alcott_GarlandForGirls.txt', encoding='utf-8').read()
#append e... |
srcole/qwm | burrito/.ipynb_checkpoints/Burrito_dimensions-checkpoint.ipynb | mit | %config InlineBackend.figure_format = 'retina'
%matplotlib inline
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import pandas as pd
import pandasql
import seaborn as sns
sns.set_style("white")
"""
Explanation: San Diego Burrito Analytics: Data characterization
Scott Cole
2 July 2016
This note... |
hetaodie/hetaodie.github.io | assets/media/uda-ml/qinghua/shijianchafenfangfa/迷你项目:时间差分方法(第 0 部分和第 1 部分)/Temporal_Difference-zh.ipynb | mit | import gym
env = gym.make('CliffWalking-v0')
"""
Explanation: 迷你项目:时间差分方法
在此 notebook 中,你将自己编写很多时间差分 (TD) 方法的实现。
虽然我们提供了一些起始代码,但是你可以删掉这些提示并从头编写代码。
第 0 部分:探索 CliffWalkingEnv
请使用以下代码单元格创建 CliffWalking 环境的实例。
End of explanation
"""
[[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
[12, 13, 14, 15, 16, 17, 18, 19, 20,... |
xgcm/xrft | doc/MITgcm_example.ipynb | mit | import numpy as np
import xarray as xr
import os.path as op
import xrft
from dask.diagnostics import ProgressBar
from xmitgcm import open_mdsdataset
from xgcm.grid import Grid
from matplotlib import colors, ticker
import matplotlib.pyplot as plt
%matplotlib inline
ddir = '/swot/SUM05/takaya/MITgcm/channel/runs/'
"""
... |
3DGenomes/tadbit | doc/source/nbpictures/tutorial_9-Compare_and_merge_Hi-C_experiments.ipynb | gpl-3.0 | from pytadbit.mapping.analyze import eig_correlate_matrices, correlate_matrices, get_reproducibility
from pytadbit.parsers.hic_parser import load_hic_data_from_bam
from matplotlib import pyplot as plt
base_path = 'results/fragment/{0}_{1}/03_filtering/valid_reads12_{0}_{1}.bam'
bias_path = 'results/fragment/{0}_{1}/03... |
AllenDowney/ModSimPy | notebooks/kitten.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... |
zzsza/Datascience_School | 18. 분류의 기초/04. 분류(classification) 성능 평가.ipynb | mit | from sklearn.metrics import confusion_matrix
y_true = [2, 0, 2, 2, 0, 1]
y_pred = [0, 0, 2, 2, 0, 2]
confusion_matrix(y_true, y_pred)
y_true = ["cat", "ant", "cat", "cat", "ant", "bird"]
y_pred = ["ant", "ant", "cat", "cat", "ant", "cat"]
confusion_matrix(y_true, y_pred, labels=["ant", "bird", "cat"])
"""
Explanatio... |
ToqueWillot/M2DAC | FDMS/TME4/TME4_FiltrageCollaboratif_V2-Copy3.ipynb | gpl-2.0 | from random import random
import math
import numpy as np
import copy
"""
Explanation: TME4 FDMS Collaborative Filtering
Florian Toqué & Paul Willot
End of explanation
"""
def loadMovieLens(path='./data/movielens'):
#Get movie titles
movies={}
rev_movies={}
for idx,line in enumerate(open(path+'/u.item... |
diego0020/va_course_2015 | AstroML/notebooks/06_learning_curves.ipynb | mit | %pylab inline
"""
Explanation: Learning Curves: Exploring the Bias-Variance Tradeoff
In practice, much of the task of machine learning involves selecting algorithms,
parameters, and sets of data to optimize the results of the method. All of these
things can affect the quality of the results, but it’s not always clear ... |
bw4sz/DeepMeerkat | training/Detection/slim/slim_walkthrough.ipynb | gpl-3.0 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
import math
import numpy as np
import tensorflow as tf
import time
from datasets import dataset_utils
# Main slim library
from tensorflow.c... |
jdweaver/ds_sandbox | homework2/10_yelp_votes_homework - joshu_weaver.ipynb | apache-2.0 | # access yelp.csv using a relative path
import pandas as pd
import seaborn as sns
yelp = pd.read_csv('C:/Users/Joshuaw/Documents/GA_Data_Science/data/yelp.csv')
yelp.head()
"""
Explanation: Linear regression homework with Yelp votes
Introduction
This assignment uses a small subset of the data from Kaggle's Yelp Busine... |
sofmonk/aima-python | games.ipynb | mit | from games import (GameState, Game, Fig52Game, TicTacToe, query_player, random_player,
alphabeta_player, minimax_decision, alphabeta_full_search,
alphabeta_search, Canvas_TicTacToe)
"""
Explanation: Games or Adversarial search
This notebook serves as supporting material for top... |
rice-solar-physics/hot_plasma_single_nanoflares | notebooks/make_hydrad_comparison_table.ipynb | bsd-2-clause | import sys
import os
import subprocess
import numpy as np
import astropy.constants as ac
from astropy.table import Table,Column
from astropy.io import ascii
sys.path.append(os.path.join(os.environ['EXP_DIR'],'ebtelPlusPlus','rsp_toolkit','python'))
from xml_io import InputHandler,OutputHandler
"""
Explanation: Make ... |
stefanbuenten/nanodegree | p2/P2_Analysis_and_Report.ipynb | mit | # load required modules
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# display plots inside the notebook
%matplotlib inline
# ensure compatibility with Python 2.x
# from __future__ import print_function
"""
Explanation: Investigate a Dataset
Udacity Data Analyst Nanode... |
rdhyee/webtech-learning | notebooks/pandas.DataFrame.adding_and_deleting.rows.ipynb | apache-2.0 | columns = ['id', 'name','color','marbles']
data = [
{'id':0, 'name': 'Fred', 'color':'red', 'marbles':2},
{'id':1, 'name': 'Zhang', 'color':'blue', 'marbles':5},
{'id':2, 'name': 'Deb', 'color':'orange', 'marbles':0}
]
df = DataFrame(data, columns=columns)
df
"""
Explanation: Goal
Learn how to add and d... |
cavestruz/MLPipeline | notebooks/anomaly_detection/sample_anomaly_detection_Caldeira.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
%matplotlib inline
import collections
"""
Explanation: Let us first explore an example that falls under novelty detection. Here, we train a model on data with some distribution and no outliers. The test data, has some "novel" subset of data t... |
raschuetz/foundations-homework | Data_and_Databases_homework/03/homework_3_schuetz.ipynb | mit | from bs4 import BeautifulSoup
from urllib.request import urlopen
html_str = urlopen("http://static.decontextualize.com/widgets2016.html").read()
document = BeautifulSoup(html_str, "html.parser")
"""
Explanation: Homework assignment #3
These problem sets focus on using the Beautiful Soup library to scrape web pages.
Pr... |
SJSlavin/phys202-2015-work | assignments/assignment12/FittingModelsEx02.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import scipy.optimize as opt
"""
Explanation: Fitting Models Exercise 2
Imports
End of explanation
"""
# YOUR CODE HERE
data = np.load("decay_osc.npz")
t = data["tdata"]
y = data["ydata"]
dy = data["dy"]
plt.errorbar(t, y, dy, fmt=".b")
assert T... |
dwhswenson/openpathsampling | examples/misc/committors.ipynb | mit | pes = toys.LinearSlope(m=[0.0], c=[0.0]) # flat line
topology = toys.Topology(n_spatial=1, masses=[1.0], pes=pes)
integrator = toys.LeapfrogVerletIntegrator(0.1)
options = {
'integ': integrator,
'n_frames_max': 1000,
'n_steps_per_frame': 1
}
engine = toys.Engine(options=options, topology=topology)
snap0 =... |
GoogleCloudPlatform/tf-estimator-tutorials | 08_Text_Analysis/03 - Text Classification - SMS Ham vs. Spam - Word Embeddings + CNN.ipynb | apache-2.0 | import tensorflow as tf
from tensorflow import data
from datetime import datetime
import multiprocessing
import shutil
print(tf.__version__)
MODEL_NAME = 'sms-class-model-01'
TRAIN_DATA_FILES_PATTERN = 'data/sms-spam/train-*.tsv'
VALID_DATA_FILES_PATTERN = 'data/sms-spam/valid-*.tsv'
VOCAB_LIST_FILE = 'data/sms-spa... |
mesgarpour/T-CARER | TCARER_summaryReports.ipynb | apache-2.0 | # reload modules
# Reload all modules (except those excluded by %aimport) every time before executing the Python code typed.
%load_ext autoreload
%autoreload 2
# import libraries
import logging
import os
import sys
import gc
import pandas as pd
import numpy as np
import random
import statistics
from datetime import d... |
metpy/MetPy | v0.8/_downloads/upperair_soundings.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import Hodograph, SkewT
from metpy.units import units
"""
Explanation: Upper Air Sounding Tutorial
Uppe... |
unmrds/cc-python | .ipynb_checkpoints/Step Through Variables and Data Types-checkpoint.ipynb | apache-2.0 | # The interpreter can be used as a calculator, and can also echo or concatenate strings.
3 + 3
3 * 3
3 ** 3
3 / 2 # classic division - output is a floating point number
# Use quotes around strings
'dogs'
# + operator can be used to concatenate strings
'dogs' + "cats"
print('Hello World!')
"""
Explanation: Exa... |
jason-neal/eniric | docs/Notebooks/Precison_with_doppler-Z-band.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
import PyAstronomy.pyasl as pyasl
from astropy import constants as const
import eniric
from eniric import config
# config.cache["location"] = None # Disable caching for these tests
config.cache["location"] = ".joblib" # Enable caching
from en... |
scikit-optimize/scikit-optimize.github.io | dev/notebooks/auto_examples/strategy-comparison.ipynb | bsd-3-clause | print(__doc__)
import numpy as np
np.random.seed(123)
import matplotlib.pyplot as plt
"""
Explanation: Comparing surrogate models
Tim Head, July 2016.
Reformatted by Holger Nahrstaedt 2020
.. currentmodule:: skopt
Bayesian optimization or sequential model-based optimization uses a surrogate
model to model the expensiv... |
mbohlool/client-python | examples/notebooks/create_deployment.ipynb | apache-2.0 | from kubernetes import client, config
"""
Explanation: How to create a Deployment
In this notebook, we show you how to create a Deployment with 3 ReplicaSets. These ReplicaSets are owned by the Deployment and are managed by the Deployment controller. We would also learn how to carry out RollingUpdate and RollBack to n... |
TomTranter/OpenPNM | examples/simulations/Coupling Continuum with Pore Network.ipynb | mit | spacing_lg = 0.00006
layer_lg = op.network.Cubic(shape=[10, 10, 1], spacing=spacing_lg)
spacing_sm = 0.00002
layer_sm = op.network.Cubic(shape=[30, 5, 1], spacing=spacing_sm)
"""
Explanation: Generate Two Networks with Different Spacing
End of explanation
"""
# Start by assigning labels to each network for identifi... |
themiurgo/folium | examples/plugins_examples.ipynb | mit | # This is to import the repository's version of folium ; not the installed one.
import sys, os
sys.path.insert(0,'..')
import folium
from folium import plugins
import numpy as np
import json
"""
Explanation: Examples of plugins usage in folium
In this notebook we show a few illustrations of folium's plugin extensions... |
phanrahan/magmathon | notebooks/advanced/inspect.ipynb | mit | import magma as m
m.set_mantle_target("ice40")
import mantle
Logic2 = m.DefineCircuit('Logic2', 'I0', m.In(m.Bit), 'I1', m.In(m.Bit), 'O', m.Out(m.Bit))
m.wire((Logic2.I0 & Logic2.I1) ^ 1, Logic2.O)
m.EndCircuit()
"""
Explanation: This notebook shows the various features for inspecting circuits using str and repr.
E... |
tensorflow/docs-l10n | site/en-snapshot/hub/tutorials/tf2_arbitrary_image_stylization.ipynb | apache-2.0 | # Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
jpilgram/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... |
robocomp/robocomp-robolab | components/detection/trafficMonitoringInOutdoorEnv/yolov3/tutorial.ipynb | gpl-3.0 | !git clone https://github.com/ultralytics/yolov3 # clone repo
%cd yolov3
%pip install -qr requirements.txt # install dependencies
import torch
from IPython.display import Image, clear_output # to display images
clear_output()
print(f"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_propertie... |
ejolly/pymer4 | docs/auto_examples/example_01_basic_usage.ipynb | mit | # import some basic libraries
import os
import pandas as pd
# import utility function for sample data path
from pymer4.utils import get_resource_path
# Load and checkout sample data
df = pd.read_csv(os.path.join(get_resource_path(), "sample_data.csv"))
print(df.head())
"""
Explanation: 1. Basic Usage Guide
:code:pym... |
geilerloui/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... |
jocialiang/gender_classifier | haarCascade_face_detection.ipynb | gpl-3.0 | %matplotlib inline
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
import math
import cv2
"""
Explanation: This notebook has been tested with
Python 3.5
OpenCV 3.1.0
Use Open CV haarcascade classifier to detect face
There are 4 different classifiers in the library file:C:\Anaconda3\envs\tens... |
turbomanage/training-data-analyst | courses/fast-and-lean-data-science/05_MNIST_Estimator_Tensorboard_playground.ipynb | apache-2.0 | import os, re, math, json, shutil, pprint, datetime
import PIL.Image, PIL.ImageFont, PIL.ImageDraw
import numpy as np
import tensorflow as tf
from matplotlib import pyplot as plt
from tensorflow.python.platform import tf_logging
print("Tensorflow version " + tf.__version__)
"""
Explanation: <a href="https://colab.rese... |
fja05680/pinkfish | examples/190.momentum-dmsr-portfolio/strategy.ipynb | mit | import datetime
import matplotlib.pyplot as plt
import pandas as pd
import pinkfish as pf
import strategy
# Format price data.
pd.options.display.float_format = '{:0.2f}'.format
%matplotlib inline
# Set size of inline plots.
'''note: rcParams can't be in same cell as import matplotlib
or %matplotlib inline
... |
encima/Comp_Thinking_In_Python | Session_10/10_OOPython.ipynb | mit | class Person:
def __init__(self, name):
self.name = name
def say_name(self):
print("Hi, I am called {}".format(self.name))
jimbob = Person("Jimbob")
jimbob.say_name()
"""
Explanation: Object-Oriented Python
Dr. Chris Gwilliams
gwilliamsc@cardiff.ac.uk
So far, we have been writing bloc... |
subhankarb/Machine-Learning-PlayGround | Machine-Learning-Specialization/machine_learning_regression/week2/multiple-regression-assignment-1.ipynb | apache-2.0 | import graphlab
"""
Explanation: Regression Week 2: Multiple Regression (Interpretation)
The goal of this first notebook is to explore multiple regression and feature engineering with existing graphlab functions.
In this notebook you will use data on house sales in King County to predict prices using multiple regressi... |
relopezbriega/mi-python-blog | content/notebooks/pyFinance.ipynb | gpl-2.0 | # graficos embebidos
%matplotlib inline
# Ejemplo FV con python
# $1000 al 6% anual por 3 años.
# importando librerías
import numpy as np
import matplotlib.pyplot as plt
x = -1000 # deposito
r = .06 # tasa de interes
n = 3 # cantidad de años
# usando la funcion fv de numpy
FV = np.fv(pv=x, rate=r, nper=n... |
AstroHackWeek/AstroHackWeek2015 | hacks/deep-learning/Deep Learning Example.ipynb | gpl-2.0 | %matplotlib inline
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
import matplotlib.pyplot as plt
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, ... |
undercertainty/ou_nlp | 10_introduction_to_artificial_neural_networks.ipynb | apache-2.0 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
# to make this notebook's output stable across runs
def reset_graph(seed=42):
tf.reset_default_graph()
tf.set_random_seed(seed)
np.random.seed(seed)
# To... |
barjacks/foundations-homework | 09/Homework_9_Skinner_Functions_and_Earthquakes_Graded.ipynb | mit | earthquake = {
'rms': '1.85',
'updated': '2014-06-11T05:22:21.596Z',
'type': 'earthquake',
'magType': 'mwp',
'longitude': '-136.6561',
'gap': '48',
'depth': '10',
'dmin': '0.811',
'mag': '5.7',
'time': '2014-06-04T11:58:58.200Z',
'latitude': '59.0001',
... |
AllenDowney/ModSimPy | examples/plague.ipynb | mit | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename):
from urllib.request import urlretrieve
local, _ = urlretrieve... |
param411singh/inf1340-2015-notebooks | Week 10.ipynb | mit | list1 = [["a", "b", "c"], [1, 2, 3]]
# print tuple(["a", "b", "c"])
# print tuple([1, 2, 3])
map(tuple, list1)
for item in list1:
tuple(item)
table1 = [["a", "b", "c"], [1, 2, 3]]
table2 = [["a", "b", "c"], [1, 2, 3]]
table3 = [["a", "b", "c"], [1, 2, 4]]
table4 = [[1, 2, 3], ["a", "b", "c"]]
# list.sort()
# s... |
woutdenolf/spectrocrunch | doc/source/tutorials/filesystems.ipynb | mit | from spectrocrunch.io import fs,localfs,h5fs,nxfs
"""
Explanation: File systems proxies
This notebook demonstrates file system proxies to folders and directories, which are basically strings (paths) with additional methods for creation, opening moving, deleting, renaming, linking and browsing. Three file systems are c... |
SnShine/aima-python | logic.ipynb | mit | from utils import *
from logic import *
"""
Explanation: Logic: logic.py; Chapters 6-8
This notebook describes the logic.py module, which covers Chapters 6 (Logical Agents), 7 (First-Order Logic) and 8 (Inference in First-Order Logic) of Artificial Intelligence: A Modern Approach. See the intro notebook for instruct... |
andrewzwicky/puzzles | FiveThirtyEightRiddler/2017-04-14/2017-04-26-empty_court_seats.ipynb | mit | from enum import Enum
import itertools
import random
from collections import Counter
import numpy as np
from plotting import *
from multiprocessing import Pool
from tqdm import tqdm_notebook
%matplotlib inline
"""
Explanation: layout: post
title: "Supreme Gridlock"
date: 2017-04-26 10:00:00
author: ... |
astarostin/MachineLearningSpecializationCoursera | course4/week2 - Непараметрические одновыборочные критерии - demo.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import itertools
from scipy import stats
from statsmodels.stats.descriptivestats import sign_test
from statsmodels.stats.weightstats import zconfint
%pylab inline
"""
Explanation: Непараметрические критерии
Критерий | Одновыборочный | Двухвыборочный | Двухвыборочный (связанные ... |
citxx/sis-python | crash-course/style-guide.ipynb | mit | # Правильно
if 1 == 3:
print(1)
if 2 == 3:
print(2)
# Неверно
if 1 == 3:
print(1)
if 2 == 3:
print(2)
"""
Explanation: <h1>Содержание<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Форматирование" data-toc-modified-id="Форматирование-1">Форм... |
robertoalotufo/ia898 | deliver/Aula9_InterpolacaoFrequencia.ipynb | mit | # import cv2
"""
Explanation: Aula 9 - Interpolação Domínio da Frequência
Correção exercícios
isccsym
Solução não é trivial. Precisamos também verificar se a função funciona com entrada de imagem complexa.
Vamos refazer este exercício, fornecendo um conjunto de imagens de teste para todos verificarem se sua implementa... |
robblack007/clase-dinamica-robot | Practicas/practica2/numerico.ipynb | mit | def f(t, x):
# Se importan funciones matematicas necesarias
from numpy import matrix, sin, cos
# Se desenvuelven las variables que componen al estado
q1, q2, q̇1, q̇2 = x
# Se definen constantes del sistema
g = 9.81
m1, m2, J1, J2 = 0.3, 0.2, 0.0005, 0.0002
l1, l2 = 0.4, 0.3
τ1, τ2 =... |
cuemacro/finmarketpy | finmarketpy_examples/finmarketpy_notebooks/backtest_example.ipynb | apache-2.0 | # for backtest and loading data
from finmarketpy.backtest import BacktestRequest, Backtest
from findatapy.market import Market, MarketDataRequest, MarketDataGenerator
from findatapy.util.fxconv import FXConv
# for logging
from findatapy.util.loggermanager import LoggerManager
# for signal generation
from finmarketpy.... |
brsaylor/atn-tools | notebooks/plot-atn-data.ipynb | gpl-3.0 | def environmentScoreNoRounding(speciesData, nodeConfig, biomassData):
numTimesteps = len(biomassData[nodeConfig[0]['nodeId']])
scores = np.empty(numTimesteps)
for timestep in range(numTimesteps):
# Calculate the Ecosystem Score for this timestep
biomass = 0
numSpecies = 0
... |
maxalbert/paper-supplement-nanoparticle-sensing | notebooks/fig_2_dipole_field_visualisation.ipynb | mit | import matplotlib.colors as colors
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import Ellipse, FancyArrow, Rectangle
from matplotlib.pyplot import cm
%matplotlib inline
"""
Explanation: Fig. 2: Dipole Field Visualisation With Particle and Nanodisc
This notebook reproduces Fig. 2 in the ... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/tfx_pipelines/pipeline/labs/tfx_pipeline.ipynb | apache-2.0 | import yaml
# Set `PATH` to include the directory containing TFX CLI and skaffold.
PATH = %env PATH
%env PATH=/home/jupyter/.local/bin:{PATH}
"""
Explanation: Continuous training with TFX and Google Cloud AI Platform
Learning Objectives
Use the TFX CLI to build a TFX pipeline.
Deploy a TFX pipeline version without t... |
exa-analytics/atomic | docs/source/notebooks/04_cluster_extraction.ipynb | apache-2.0 | from exa.util import isotopes
import exatomic
from exatomic.core.two import compute_atom_two_out_of_core # If we need to compute atom_two out of core (low RAM)
from exatomic.algorithms.neighbors import periodic_nearest_neighbors_by_atom # Only valid for simple cubic periodic cells
from exatomic.base import resour... |
constellationcolon/simplexity | .ipynb_checkpoints/lpsm-checkpoint.ipynb | mit | fig = plt.figure()
axes = fig.add_subplot(1,1,1)
# define view
r_min = 0.0
r_max = 3.0
s_min = 0.0
s_max = 5.0
res = 50
r = numpy.linspace(r_min, r_max, res)
# plot axes
axes.axhline(0, color='#B3B3B3', linewidth=5)
axes.axvline(0, color='#B3B3B3', linewidth=5)
# plot constraints
c_1 = lambda x: 4 - 2*x
c_2 = lambd... |
jacksongomesbr/academia-md | Introducao.ipynb | cc0-1.0 | %matplotlib inline
"""
Explanation: Introdução
End of explanation
"""
from pylab import *
x = linspace(0, 5, 6)
y = x ** 2
subplot(1,2,1)
plot(x, y, 'r-')
subplot(1,2,2)
plot(x, y, 'g*-');
"""
Explanation: Matemática Discreta
As Diretrizes Curriculares do MEC para os cursos de computação e informática definem que:... |
enbanuel/phys202-2015-work | assignments/assignment05/InteractEx02.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 2
Imports
End of explanation
"""
# YOUR CODE HERE
def plot_sine1(a, b):
x = np.arange(0, 4*np.pi, 0.1)
... |
JeffAbrahamson/MLWeek | theory/J1-4_logistic-regression/logistic_regression.ipynb | gpl-3.0 | # Inspired by https://stackoverflow.com/questions/20045994/how-do-i-plot-the-decision-boundary-of-a-regression-using-matplotlib
# and http://stackoverflow.com/questions/28256058/plotting-decision-boundary-of-logistic-regression
X = np.array(rouge + bleu)
y = [1] * len(rouge) + [0] * len(bleu)
logreg = LogisticRegress... |
martinjrobins/hobo | examples/toy/model-fitzhugh-nagumo.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
import numpy as np
import pints
import pints.toy
# Create a model
model = pints.toy.FitzhughNagumoModel()
# Run a simulation
parameters = [0.1, 0.5, 3]
times = np.linspace(0, 20, 200)
values = model.simulate(parameters, times)
# Plot the results
plt.figure()
plt.xlabel('Time')
plt.yla... |
abhay1/tf_rundown | notebooks/Feed Forward Neural Network.ipynb | mit | # Necessary imports
import time
from IPython import display
import numpy as np
from matplotlib.pyplot import imshow
from PIL import Image, ImageOps
import tensorflow as tf
%matplotlib inline
from tensorflow.examples.tutorials.mnist import input_data
# Read the mnist dataset
mnist = input_data.read_data_sets("/tmp/d... |
liganega/Gongsu-DataSci | previous/notes2017/W03/GongSu07_Funcions_and_Modules.ipynb | gpl-3.0 | def mysum(a, b):
return a + b
"""
Explanation: 함수와 모듈 알아보기
함수와 모듈을 이미 사용해 보았다.
이번 장에서 좀 더 자세히 함수와 모듈의 활용을 알아 본다.
오늘의 주요 예제
쇼핑할 항목을 담고 있는 shopping_list.txt 파일이 있을 때,
쇼핑할 때 필요한 비용을 계산하는 함수 구현하기.
예를 들어, 쇼핑 목록이 아래와 같을 때, 6,500원의 비용이 필요하다는 것을 계산해 주는 함수를 구현하고자 한다.
항목 개수 금액
Bread 1 3000
Tomato 6 2000
Cola 1 ... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 5 Data analysis applications/Homework/1 test autocorrelation and stationarity/Test Autocorrelation and stationarity.ipynb | mit | from __future__ import division
import numpy as np
import pandas as pd
import statsmodels.api as sm
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
#Reading milk data
milk = pd.read_c... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/Errors and Exceptions Handling.ipynb | apache-2.0 | print 'Hello
"""
Explanation: Errors and Exception Handling
In this lecture we will learn about Errors and Exception Handling in Python. You've definitely already encountered errors by this point in the course. For example:
End of explanation
"""
try:
f = open('testfile','w')
f.write('Test write this')
excep... |
ES-DOC/esdoc-jupyterhub | notebooks/dwd/cmip6/models/mpi-esm-1-2-hr/landice.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'dwd', 'mpi-esm-1-2-hr', 'landice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: DWD
Source ID: MPI-ESM-1-2-HR
Topic: Landice
Sub-Topics: Glaciers, Ice.
Pro... |
abhishekraok/LayeredNeuralNetwork | notebook/Exploring weights.ipynb | mit | import sys
import os
sys.path.insert(0,'..')
sys.path.insert(0,'../layeredneuralnetwork/')
"""
Explanation: Exploring Weights
Here we train the LNN on various task and see how the weights are
End of explanation
"""
from layered_neural_network import LayeredNeuralNetwork
input_dimension = 2
lnn = LayeredNeuralNetwork... |
adamwang0705/cross_media_affect_analysis | develop/20171002-daheng-load_and_prepare_data.ipynb | mit | """
Initialization
"""
'''
Standard modules
'''
import os
import sqlite3
import csv
import time
import codecs
from pprint import pprint
'''
Analysis modules
'''
import pandas as pd
'''
Custom modules
'''
import config
import utilities
'''
Misc
'''
nb_name = '20171002-daheng-load_and_prepare_data'
"""
Explanation: ... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session04/Day3/GPTutorial2_WithSolutions.ipynb | mit | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import george, emcee, corner
from scipy.optimize import minimize
"""
Explanation: Gaussian Process regression tutorial 2: Solutions
In this tutorial, we are to explore some slightly more realistic applications... |
saashimi/code_guild | interactive-coding-challenges/sorting_searching/insertion_sort/insertion_sort_challenge.ipynb | mit | def insertion_sort(data):
# 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: Implement insertion sort.
Constraints
Test Cases
Algorithm
Code
Unit Test
Solution Notebook
Constraints
Is ... |
monicathieu/cu-psych-r-tutorial | public/tutorials/python/3-datamanipulation/index.ipynb | mit | # load packages we will be using for this lesson
import pandas as pd
"""
Explanation: title: "Data Manipulation in Python"
subtitle: "CU Psych Scientific Computing Workshop"
weight: 1301
tags: ["core", "python"]
Goals of this Lesson
Students will learn:
How to group and categorize data in Python
How to generative de... |
mayank-johri/LearnSeleniumUsingPython | Section 2 - Advance Python/Chapter S2.08 - Automated Testing/Automated Testing - Introduction.ipynb | gpl-3.0 | from unittest import TestCase
def fun(x):
return x + 1
class MyTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_passing_int_value(self):
self.assertEqual(fun(3), 4)
"""
Explanation: Testing your code is very important.
Getting used to writing t... |
martinjrobins/hobo | examples/plotting/mcmc-pairwise-scatterplots.ipynb | bsd-3-clause | import pints
import pints.toy as toy
import numpy as np
import matplotlib.pyplot as plt
# Load a forward model
model = toy.LogisticModel()
# Create some toy data
real_parameters = [0.015, 500] # growth rate, carrying capacity
times = np.linspace(0, 1000, 100)
org_values = model.simulate(real_parameters, times)
# Ad... |
dietmarw/EK5312_ElectricalMachines | Chapman/Ch4-Example_4-04.ipynb | unlicense | %pylab notebook
%precision 4
"""
Explanation: Electric Machinery Fundamentals 5th edition
Chapter 4 (Code examples)
Example 4-4
Plot the terminal characteristics of the generator of Example 4-3 with a 0.8 PF leading and lagging load.
Import the PyLab namespace (provides set of useful commands and constants like Pi) a... |
Olsthoorn/TransientGroundwaterFlow | readthedocs/Course2016_jupyter/docs/source/ReversibleStorage.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import pdb
"""
Explanation: Reversible groundwater storage
End of explanation
"""
dg = np.array([0.002, 0.063, 0.2, 0.630, 2.0 ]) * 1e-3 # mm
"""
Explanation: Introduction
In the remainder of this syllabus, we will restrict ourselves to reversible groundwater stora... |
mnschmit/LMU-Syntax-nat-rlicher-Sprachen | 07-notebook-after-class.ipynb | apache-2.0 | grammar = """
S -> NP VP
NP -> DET[GEN=?x] NOM[GEN=?x]
NOM[GEN=?x] -> ADJ NOM[GEN=?x] | N[GEN=?x]
ADJ -> "schöne" | "kluge" | "dicke"
DET[GEN=mask,KAS=nom] -> "der"
DET[GEN=fem,KAS=dat] -> "der"
DET[GEN=fem,KAS=nom] -> "die"
DET[GEN=fem,KAS=akk] -> "die"
DET[GEN=neut,KAS=nom] -> "das"
DET[GEN=neut,KAS=akk] -> "das... |
metpy/MetPy | v0.9/_downloads/e379551d6fc4f1810666043df78073ac/upperair_soundings.ipynb | bsd-3-clause | import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import Hodograph, SkewT
from metpy.units import units
"""
Explanation: Upper Air Sounding Tutorial
Uppe... |
quantumlib/Cirq | docs/circuits.ipynb | apache-2.0 | try:
import cirq
except ImportError:
print("installing cirq...")
!pip install --quiet cirq
import cirq
print("installed cirq.")
"""
Explanation: Circuits
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https://quantumai.google/cirq/circuits"><img src="https://... |
DeepLearningUB/DeepLearningMaster | 2. Automatic Differentiation.ipynb | mit | !pip install autograd
"""
Explanation: Automatic Differentiation
The backpropagation algorithm was originally introduced in the 1970s, but its importance wasn't fully appreciated until a famous 1986 paper by David Rumelhart, Geoffrey Hinton, and Ronald Williams. (Michael Nielsen in "Neural Networks and Deep Learning"... |
quoniammm/happy-machine-learning | Udacity-DL/.ipynb_checkpoints/keyboard-shortcuts-checkpoint.ipynb | mit | # mode practice
"""
Explanation: Keyboard shortcuts
In this notebook, you'll get some practice using keyboard shortcuts. These are key to becoming proficient at using notebooks and will greatly increase your work speed.
First up, switching between edit mode and command mode. Edit mode allows you to type into cells whi... |
explosion/thinc | examples/05_visualizing_models.ipynb | mit | !pip install "thinc>=8.0.0" pydot graphviz svgwrite
"""
Explanation: Visualizing Thinc models (with shape inference)
This is a simple notebook showing how you can easily visualize your Thinc models and their inputs and outputs using Graphviz and pydot. If you're installing pydot via the notebook, make sure to restart ... |
scikit-optimize/scikit-optimize.github.io | 0.7/notebooks/auto_examples/store-and-load-results.ipynb | bsd-3-clause | print(__doc__)
import numpy as np
import os
import sys
# The followings are hacks to allow sphinx-gallery to run the example.
sys.path.insert(0, os.getcwd())
main_dir = os.path.basename(sys.modules['__main__'].__file__)
IS_RUN_WITH_SPHINX_GALLERY = main_dir != os.getcwd()
"""
Explanation: ============================... |
evangelistalab/forte | tutorials/Tutorial_03.00_DSRG-PT2.ipynb | lgpl-3.0 | import psi4
import forte
import forte.utils
# water molecule
geom = """0 1
O
H 1 1.2
H 1 1.2 2 120.0
"""
basis = '6-31g'
Escf, wfn = forte.utils.psi4_scf(geom, basis, 'rhf')
print(f"RHF energy: {Escf:.8f} Eh")
# Run Psi4 MP2
psi4.set_options({'mp2_type': 'conv',
'freeze_core': False})
Emp2_psi4 =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.