repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
ibab/tensorprob | examples/example1_particle_decays.ipynb | mit | %matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from tensorprob import Model, Parameter, Normal, Exponential, Mix2, ScipyLBFGSBOptimizer
# We use the matplotlib_hep library to easily create high energy physics plots
from matplotlib_hep import histpoints
plt.rcParams['figure.figsize'] = (10.0,... |
phoebe-project/phoebe2-docs | 2.2/tutorials/compute_times_phases.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.2,<2.3"
"""
Explanation: Advanced: compute_times & compute_phases
Setup
Let's first make sure we have the latest version of PHOEBE 2.2 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
"""
... |
brettavedisian/Liquid-Crystals-Summer-2015 | Smectic/Mapping.ipynb | mit | %matplotlib inline
from sympy import *
import matplotlib.pyplot as plt
import numpy as np
init_printing(use_unicode=True)
r, u, v, c, r_c, u_c, v_c, E, p, r_p, u_p, v_p, e, a, b, q, b_0, b_1, b_2, b_3, q_0, q_1, q_2, q_3, q_4, q_5, beta, rho, epsilon, delta, d, K_3, Omega, Lambda, lamda, C, mu, Gamma, tau, nu, xi, P_x... |
AdityaSoni19031997/Machine-Learning | AV/adi_basics_1.ipynb | mit | %load_ext autoreload
%autoreload 2
%matplotlib inline
import time
import xgboost as xgb
import lightgbm as lgb
# import category_encoders as cat_ed
# import gc, mlcrate, glob
# from gplearn.genetic import SymbolicTransformer, SymbolicRegressor
from fastai.imports import *
from fastai.structured import *
from pandas_... |
greenelab/GCB535 | 31_ML-IV/ML_4.ipynb | bsd-3-clause | # numpy provides python tools to easily load comma separated files.
import numpy as np
# use numpy to load disease #1 data
d1 = np.loadtxt(open("../31_Data_ML-IV/D1.csv", "rb"), delimiter=",")
# features are all rows for columns before 200
# The canonical way to name this is that X is our matrix of
# examples by feat... |
nickcdryan/hep_ml | notebooks/DemoNeuralNetworks.ipynb | apache-2.0 | !cd toy_datasets; wget -O ../data/MiniBooNE_PID.txt -nc MiniBooNE_PID.txt https://archive.ics.uci.edu/ml/machine-learning-databases/00199/MiniBooNE_PID.txt
import numpy, pandas
from sklearn.cross_validation import train_test_split
from sklearn.metrics import roc_auc_score
data = pandas.read_csv('../data/MiniBooNE_PID... |
fweik/espresso | doc/tutorials/lattice_boltzmann/lattice_boltzmann_part3.ipynb | gpl-3.0 | def solvent_langevin(system, kT, gamma):
'''
Implicit solvation model based on Langevin dynamics (Rouse model).
'''
system.thermostat.set_langevin(kT=kT, gamma=gamma, seed=42)
def solvent_lbm(system, kT, gamma):
'''
Lattice-based solvation model based on the LBM (Zimm model).
'''
lbf =... |
braemy/mentor-mentee-recommender-system | 1.Preprocessing.ipynb | mit | from importlib import reload
import xml_parser
reload(xml_parser)
from xml_parser import Xml_parser
#Xml_parser = Xml_parser().collect_data("../pmi_data")
"""
Explanation: Data Mining
First thing to do is to find the structure of the file. We can find a description in the "dblp.dtd" file and on the website:
The chil... |
deepmind/bsuite | bsuite/analysis/results.ipynb | apache-2.0 | #@title Imports
! pip install --quiet git+git://github.com/deepmind/bsuite
import warnings
from bsuite.experiments import summary_analysis
from bsuite.logging import csv_load
from bsuite.logging import sqlite_load
import numpy as np
import pandas as pd
import plotnine as gg
pd.options.mode.chained_assignment = None... |
dereneaton/ipyrad | newdocs/API-analysis/cookbook-bucky.ipynb | gpl-3.0 | ## conda install -c BioBuilds mrbayes
## conda install -c ipyrad ipyrad
## conda install -c ipyrad bucky
## import Python libraries
import ipyrad.analysis as ipa
import ipyparallel as ipp
"""
Explanation: ipyrad-analysis toolkit: BUCKy
This notebook uses the Pedicularis example data set from the first empirical ipyra... |
mne-tools/mne-tools.github.io | dev/_downloads/511c644e95ae48be8cf394cec24a1865/80_brainstorm_phantom_elekta.ipynb | bsd-3-clause | # Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import find_events, fit_dipole
from mne.datasets import fetch_phantom
from mne.datasets.brainstorm import bst_phantom_elekta
from mne.io import read_ra... |
jeroarenas/MLBigData | 3_TopicModeling/TM2_Topic_Modeling_student.ipynb | mit | %matplotlib inline
# Required imports
from wikitools import wiki
from wikitools import category
import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
import gensim
import numpy as np
import lda
import lda.datasets
from time import time
from sk... |
pybel/pybel-notebooks | summary/Citation Analysis.ipynb | apache-2.0 | import itertools as itt
import os
import time
from collections import defaultdict, Counter
from operator import itemgetter
import pandas as pd
import pybel
import pybel_tools as pbt
from pybel.constants import *
"""
Explanation: Abstract
Author: Charles Tapley Hoyt
This notebook outlines a simple way to explore the ... |
Wei1234c/Elastic_Network_of_Things_with_MQTT_and_MicroPython | notebooks/demo/PyCon TW 2017 demo NN.ipynb | gpl-3.0 | import os
import sys
import time
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, os.path.sep.join(['..', 'codes']), 'client')))
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, os.path.sep.join(['..', 'codes']), 'node')))
sys.path.append(os.path.abspath(os.path.join(os.path.pardir, os.path.se... |
sangheestyle/ml2015project | howto/model01_linear_regression.ipynb | mit | import gzip
import cPickle as pickle
with gzip.open("../data/train.pklz", "rb") as train_file:
train_set = pickle.load(train_file)
with gzip.open("../data/test.pklz", "rb") as test_file:
test_set = pickle.load(test_file)
with gzip.open("../data/questions.pklz", "rb") as questions_file:
questions = pickle... |
rubensfernando/mba-analytics-big-data | Python/2016-08-08/aula7-parte1-reacoes.ipynb | mit | import requests
"""
Explanation: Recuperando as reações de um post
End of explanation
"""
url_base = 'https://graph.facebook.com/v2.7'
"""
Explanation: Iremos definir a URL base para realizar as requisições.
End of explanation
"""
id_post = '/134488303306371_1056521637769695'
no = id_post
"""
Explanation: Agora... |
gsorianob/fiuba-python | Clase 06 - Archivos binarios, Corte de control.ipynb | apache-2.0 | try:
with open('ejemplo.txt') as fd:
print '¿El archivo se encuentra cerrado?', fd.closed
a += 2 # Como la variable a no existe, va a tirar
# una excepción del tipo NameError
print 'Estas líneas nunca se van a mostrar porque'
print 'antes va a ocurrir un error'
excep... |
TomTranter/OpenPNM | examples/topology/Adding Boundary Pores.ipynb | mit | import numpy as np
import openpnm as op
np.random.seed(10)
%matplotlib inline
"""
Explanation: Adding Boundary Pores
End of explanation
"""
pn = op.network.Delaunay(num_points=200, shape=[1, 1, 0])
print(pn)
"""
Explanation: Start by creating a Delaunay network. Because it uses random base points it will better il... |
banyh/ShareIPythonNotebook | Module - itertools.ipynb | gpl-3.0 | # 這是一個 infinite generator,用來產生Fibonacci數列
def fibonacci():
i, j = 0, 1
while True:
yield j # 當傳回 j 之後,函式會停留在這一行,直到下一次呼叫為止
i, j = j, i + j
# 印出1~500的fibonacci sequence
for x in fibonacci():
if x > 500: break
print x,
"""
Explanation: generator是指一個函式,能夠產生一個sequence,但每產生一個值後,就會傳回值並將函式保持在... |
mtat76/atm-py | examples/instruments_POPS_raw.ipynb | mit | from atmPy.instruments.POPS import raw
from atmPy.tools import plt_tools
%matplotlib inline
plt_tools.setRcParams(plt)
"""
Explanation: Introduction
POPS reads a section of raw signal every now and then. This module helps you with these raw-files.
Imports
End of explanation
"""
pops_raw = raw.load_raw('./data/POPS_R... |
astarostin/MachineLearningSpecializationCoursera | course4/week2 - Проверка гипотез о долях (Z-критерий для двух долей) - demo.ipynb | apache-2.0 | import numpy as np
import pandas as pd
import scipy
from statsmodels.stats.weightstats import *
from statsmodels.stats.proportion import proportion_confint
"""
Explanation: Z-критерий для двух долей
End of explanation
"""
data = pd.read_csv('banner_click_stat.txt', header = None, sep = '\t')
data.columns = ['banner... |
darkomen/TFG | medidas/20072015/BQ/.ipynb_checkpoints/Untitled-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... |
google-research/google-research | kip/dataset.ipynb | apache-2.0 | import pandas as pd
import tensorflow as tf
import numpy as np
pd.set_option('expand_frame_repr', True)
pd.set_option("display.max_rows", 100)
pd.set_option('max_colwidth',90)
"""
Explanation: Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in ... |
SCPSscience/Notebooks | Classification of Organisms.ipynb | mit | # Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Our data is the dichotomous key table and is defined as the word 'key'.
# key is set equal to the .csv file that is read by pandas.
# The .csv file must be in the same directory a... |
kgrodzicki/machine-learning-specialization | course-2-regression/notebooks/week-5-lasso-assignment-1-blank.ipynb | mit | import graphlab
"""
Explanation: Regression Week 5: Feature Selection and LASSO (Interpretation)
In this notebook, you will use LASSO to select features, building on a pre-implemented solver for LASSO (using GraphLab Create, though you can use other solvers). You will:
* Run LASSO with different L1 penalties.
* Choose... |
vitojph/kschool-nlp | notebooks-py3/superbowl.ipynb | gpl-3.0 | !gunzip ../data/2017-superbowl-tweets.tsv.gz
!ls ../data
tweets = []
RUTA = '../data/2017-superbowl-tweets.tsv'
for line in open(RUTA).readlines():
tweets.append(line.split('\t'))
"""
Explanation: Superbowl 2017
tl;dr
Vamos a analizar una colección de tweets en inglés publicados durante un partido de fútbol.
Cont... |
nholtz/structural-analysis | matrix-methods/frame2d/Frame2D/Frame2D_Input.ipynb | cc0-1.0 | from salib import extend, NBImporter
from Tables import Table, DataSource
from Nodes import Node
from Members import Member
from LoadSets import LoadSet, LoadCombination
from NodeLoads import makeNodeLoad
from MemberLoads import makeMemberLoad
from collections import OrderedDict, defaultdict
import numpy as np
from Fr... |
cliburn/sta-663-2017 | worksheet/01_Programming_In_Python_Solutions.ipynb | mit | fb = []
for i in range(100):
if i % 15 == 0:
fb.append("fizz buzz")
elif i % 5 == 0:
fb.append("buzz")
elif i % 3 == 0:
fb.append("fizz")
else:
fb.append(i)
fb
"""
Explanation: 1. Replicate the contents below by creating a new (MarkDown) cell below this one (usi... |
bumblebeefr/pyCTS2000 | Tests d'impression.ipynb | gpl-2.0 | n1=1
n2=1
w(GS+'*')
w(chr(n1))
w(chr(n2))
for k in range(4*n1):
for l in range(n2):
w("\xFA")
w("\xF0")
"""
Explanation: Impression d'images
GS * n1 n2 [ d ] n1 x n2 x 8
cf page 50
[Function]
Defining the download bit image
[Code]
* <1D>H<2A>H<n1><n2> [< d >] n1 x n2 x 8
[Range]
* 1≤n1≤255
* 1≤... |
Rauf-Kurbanov/au_dl_course | seminar_1/homework_task1.ipynb | gpl-3.0 | def task_1a_np(x, y):
return np.where(x > y, x + y, x - y)
X = tf.placeholder(tf.float64)
Y = tf.placeholder(tf.float64)
out = tf.cond(tf.greater(X, Y), lambda: tf.add(X, Y), lambda: tf.subtract(X, Y))
with tf.Session() as sess:
for xx, yy in np.random.uniform(size=(50, 2)):
actual = sess.run(out, fee... |
orlox/binary_tools | priors/notebooks/priors.ipynb | gpl-3.0 | from binary_tools.priors.priors import*
"""
Explanation: Priors
End of explanation
"""
print(default_function(55,2.3),default_function_log(1.4,0))
"""
Explanation: In this file there are a series of functions that calculate the probability of initial conditions on a binary system.
The first part contains a few defa... |
JohnMarohn/FreqDemod | freqdemod/docs/freqdemod-quickstart-1.ipynb | gpl-3.0 | from freqdemod import Signal
"""
Explanation: freqdemod-quickstart-1
Author information
John A. Marohn (jam99@cornell.edu)
Department of Chemistry and Chemical Biology
Cornell University
Ithaca, NY USA; 14853-1301
Date
2014/11/23
Abstract
Create a sine wave with noise and demodulate it to obtains the sine wave's frequ... |
mit-crpg/openmc | examples/jupyter/mg-mode-part-iii.ipynb | mit | import os
import matplotlib.pyplot as plt
import numpy as np
import openmc
%matplotlib inline
"""
Explanation: Multigroup Mode Part III: Advanced Feature Showcase
This Notebook illustrates the use of the the more advanced features of OpenMC's multi-group mode and the openmc.mgxs.Library class. During this process, t... |
CalPolyPat/phys202-2015-work | assignments/assignment03/NumpyEx03.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import antipackage
import github.ellisonbg.misc.vizarray as va
"""
Explanation: Numpy Exercise 3
Imports
End of explanation
"""
def brownian(maxt, n):
"""Return one realization of a Brownian (Wiener) process with n steps... |
statsmodels/statsmodels.github.io | v0.12.1/examples/notebooks/generated/statespace_local_linear_trend.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import pandas as pd
from scipy.stats import norm
import statsmodels.api as sm
import matplotlib.pyplot as plt
"""
Explanation: State space modeling: Local Linear Trends
This notebook describes how to extend the statsmodels statespace classes to create and estimate a custom model.... |
saashimi/code_guild | wk9/notebooks/ch.1-getting-started-with-django.ipynb | mit | # Make a directory called examples
#!mkdir ../examples
%cd ../examples
!ls
"""
Explanation: Wk9.0
Ch. 1 Getting Django Set Up Using a Functional Test
Obey the testing goat! Do nothing until you have a test
Before even installing anything, we'll write a test.
Writing our first test
End of explanation
"""
#%%writefil... |
ilivans/information-retrieval | 08_simhash_prob_search/simhash_prob.ipynb | mit | tokenize = RegexpTokenizer("\w+").tokenize
positive_hash = lambda word: hash(word) % ((sys.maxsize + 1) * 2)
dir_path = "/home/ilivans/data/simple.wiki/pages"
assert os.path.exists(dir_path)
def remained_time(start, i, total, step=500):
if i % step == 0:
spent = time() - start
clear_output()
... |
briennakh/BIOF509 | Wk01/Wk01-Overview.ipynb | mit | import numpy as np
print("Numpy:", np.__version__)
"""
Explanation: Week 1 - Getting Started
End of explanation
"""
location = 'Bethesda'
zip_code = 20892
elevation = 71.9
print("We're in", location, "zip code", zip_code, ", ", elevation, "m above sea level")
print("We're in " + location + " zip code " + str(zip_c... |
uber/pyro | tutorial/source/stable.ipynb | apache-2.0 | import math
import os
import torch
import pyro
import pyro.distributions as dist
from matplotlib import pyplot
from torch.distributions import constraints
from pyro import poutine
from pyro.contrib.examples.finance import load_snp500
from pyro.infer import EnergyDistance, Predictive, SVI, Trace_ELBO
from pyro.infer.au... |
kiseyno92/SNU_ML | 0707 비즈니스 밸류 창출 프로세스_2/2/(3) bow and word cloud.ipynb | mit | from konlpy.tag import Twitter
import pandas as pd
# 연합뉴스 로딩
kor_corpus = pd.read_csv(r'한류_연합뉴스.csv', encoding='cp949')
pos_tagger = Twitter()
# 한글 문서 명사만 뽑아서 tf-idf
total_news = []
stopword = ['것','수','저']
for news in kor_corpus['contents'].head():
pos_news = ['/'.join(t[:-1]) for t in pos_tagger.pos(news) if ... |
vzg100/Post-Translational-Modification-Prediction | .ipynb_checkpoints/Lysine Acetylation -Forest-checkpoint.ipynb | mit | from pred import Predictor
from pred import sequence_vector
from pred import chemical_vector
"""
Explanation: Template for test
End of explanation
"""
par = ["pass", "ADASYN", "SMOTEENN", "random_under_sample", "ncl", "near_miss"]
for i in par:
print("y", i)
y = Predictor()
y.load_data(file="Data/Trainin... |
jupyter/strata-sv-2015-tutorial | 01 - Multimedia.ipynb | bsd-3-clause | from IPython.display import display
"""
Explanation: Rich Output
In Python, objects can declare their textual representation using the __repr__ method. IPython expands on this idea and allows objects to declare other, rich representations including:
HTML
JSON
PNG
JPEG
SVG
LaTeX
A single object can declare some or a... |
fastai/fastai | nbs/14_callback.schedule.ipynb | apache-2.0 | from fastai.test_utils import *
"""
Explanation: Hyperparam schedule
Callback and helper functions to schedule any hyper-parameter
End of explanation
"""
#|export
class _Annealer:
def __init__(self, f, start, end): store_attr('f,start,end')
def __call__(self, pos): return self.f(self.start, self.end, pos)
... |
jonahgolden/Jonah_Final_Project | src/Solar_Notebook.ipynb | mit | def Solar_Power_Calculator(Day_Of_Year,Lattitude,Hour_of_Day):
'''This function will tell you how much power the sun is radiating on one square meter
of the earth when it is sunny in any location in the world at any time.
Inputs: Day_Of_Year, Lattitude, Hour_of_Day
Output: Power (watts)'''
# Make so... |
jay-johnson/sci-pype | red10/Red10-Intro.ipynb | apache-2.0 | from __future__ import print_function
import sys, os, requests, json, datetime
# Load the environment and login the user
from src.common.load_redten_ipython_env import user_token, user_login, csv_file, run_job, core, api_urls, ppj, rt_url, rt_user, rt_pass, rt_email, lg, good, boom, anmt, mark, ppj, uni_key, rest_logi... |
danellecline/stoqs | stoqs/contrib/notebooks/CCE_BEDs_queries.ipynb | gpl-3.0 | acts = (Activity.objects.using('stoqs_cce2015')
.filter(name__contains='trajectory')
.order_by('name'))
"""
Explanation: Query Coordianted Canyon Experiment database for BED information
Connect to a remote database, select specific data using Django queries
Executing this Notebook requires a personal S... |
mne-tools/mne-tools.github.io | 0.23/_downloads/2455121b46e43615a45b660a36d0ad93/30_epochs_metadata.ipynb | bsd-3-clause | import os
import numpy as np
import pandas as pd
import mne
kiloword_data_folder = mne.datasets.kiloword.data_path()
kiloword_data_file = os.path.join(kiloword_data_folder,
'kword_metadata-epo.fif')
epochs = mne.read_epochs(kiloword_data_file)
"""
Explanation: Working with Epoch meta... |
sr320/sr320.github.io | jupyter/Cgigas/Lotterhos BS samples.ipynb | mit | bsmaploc="/Applications/bioinfo/BSMAP/bsmap-2.74/"
"""
Explanation: Analysis of two oyster samples where Lotterhos did methylRAD
The M2 and M3 samples are here:
http://owl.fish.washington.edu/nightingales/C_gigas/9_GATCAG_L001_R1_001.fastq.gz
http://owl.fish.washington.edu/nightingales/C_gigas/10_TAGCTT_L001_R1_001.f... |
statsmodels/statsmodels.github.io | v0.13.0/examples/notebooks/generated/glm.ipynb | bsd-3-clause | %matplotlib inline
import numpy as np
import statsmodels.api as sm
from scipy import stats
from matplotlib import pyplot as plt
plt.rc("figure", figsize=(16,8))
plt.rc("font", size=14)
"""
Explanation: Generalized Linear Models
End of explanation
"""
print(sm.datasets.star98.NOTE)
"""
Explanation: GLM: Binomial r... |
bocklund/notebooks | pycalphad/model_refstates.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from pycalphad import Database, Model, calculate
CR_FE_BCC_MAGNETIC_DBF = Database("""
ELEMENT CR BLANK 0 0 0 !
ELEMENT FE BLANK 0 0 0 !
FUNCTION GHSERCR 298.15 -1.47721E-6*T**3 + 0.00189435*T**2 - 26.908*T*LN(T) +
157.48*T - 8856.94 + 139250*T**(-1); 2180.0 Y -50... |
Diyago/Machine-Learning-scripts | general studies/learning python/4. Классы и функции.ipynb | apache-2.0 | # функции
def product(*args):
result = 1
for arg in args:
result *= arg
return result
print (product(3,4,6))
def product(*args, power = 2):
result = 1
for arg in args:
result *= arg**power
return result
print (product(3,4,6))
# Задача. Найти сумму длин входящих слов. Количество... |
saashimi/code_guild | interactive-coding-challenges/staging/sorting_searching/group_ordered/group_ordered_solution.ipynb | mit | def make_order_list(list_in):
order_list = []
for item in list_in:
if item not in order_list:
order_list.append(item)
return order_list
def group_ordered(list_in):
if list_in is None:
return None
order_list = make_order_list(list_in)
current = 0
for item in orde... |
jmausolf/Python_Tutorials | PCA/PCA_in_Python.ipynb | mit | import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
iris = datasets.load_iris()
X = iris.data
y = iris.target
target_names = iris.target_names
pca = PCA(n_components=2)
X_r = pca.fit(X).transform(X)
... |
QuantCrimAtLeeds/PredictCode | notebooks/SaTScan Replication.ipynb | artistic-2.0 | import pyproj
proj = pyproj.Proj(init="epsg:2260")# New York
coord_lookup = dict()
raw_coord_lookup = dict()
with open("NYCfever.geo") as geofile:
for line in geofile:
idcode, lat, lon = line.split()
lon, lat = float(lon), float(lat)
x, y = proj(lon, lat)
if idcode in coord_lookup:
... |
halfak/are-the-bots-really-fighting | analysis/main/7-3-comments-sample-diffs.ipynb | mit | user_agent_email = "REPLACE THIS WITH YOUR EMAIL plz kthxbye"
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import glob
import pickle
import numpy as np
import mwapi
%matplotlib inline
import datetime
start = datetime.datetime.now()
"""
Explanation: Section 7.3: Sample... |
tpin3694/tpin3694.github.io | machine-learning/precision.ipynb | mit | # Load libraries
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import make_classification
"""
Explanation: Title: Precision
Slug: precision
Summary: How to evaluate a Python machine learning using precision.
Date: 2017-09-15 12:00
Catego... |
zczapran/datascienceintensive | logistic_regression/Mini_Project_Logistic_Regression.ipynb | mit | %matplotlib inline
import numpy as np
import scipy as sp
import matplotlib as mpl
import matplotlib.cm as cm
from matplotlib.colors import ListedColormap
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.width', 500)
pd.set_option('display.max_columns', 100)
pd.set_option('display.notebook_repr... |
h2oai/h2o-3 | h2o-py/demos/isolationforest_valid.ipynb | apache-2.0 | import sys
import h2o
from h2o.frame import H2OFrame
import numpy as np
import pandas as pd
h2o.init(strict_version_check=False)
"""
Explanation: New features in Isolation Forest: contamination ratio and using validation frame
We will demonstrate how to use contamination parameter to get predicted labels out of an Is... |
gojira/tensorflow | tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb | apache-2.0 | # Install TensorFlow; note that Colab notebooks run remotely, on virtual
# instances provided by Google.
!pip install -U -q tf-nightly
import os
import time
import tensorflow as tf
from tensorflow.contrib import autograph
import matplotlib.pyplot as plt
import numpy as np
import six
from google.colab import widgets... |
deniederhut/workshop_pyintensive | instructor/day_two.ipynb | bsd-2-clause | import requests
r = requests.get("http://en.wikipedia.org/wiki/Main_Page")
"""
Explanation: Day 2 - Getting Data with Python
Something about automation and scripts
Something about exceptions
Let's try a challenge!
Error handling - or having a computer program anticipate and respond to errors created by other function... |
akchinSTC/systemml | samples/jupyter-notebooks/Autoencoder.ipynb | apache-2.0 | !pip show systemml
import pandas as pd
from systemml import MLContext, dml
ml = MLContext(sc)
print(ml.info())
sc.version
"""
Explanation: Autoencoder
This notebook demonstrates the invocation of the SystemML autoencoder script, and alternative ways of passing in/out data.
This notebook is supported with SystemML 0.1... |
ecell/ecell4-notebooks | en/tutorials/tutorial08.ipynb | gpl-2.0 | %matplotlib inline
from ecell4.prelude import *
with reaction_rules():
A + B == C | (0.01, 0.3)
run_simulation(10.0, {'C': 60}, volume=1.0)
"""
Explanation: 8. More about 1. Brief Tour of E-Cell4 Simulations
Once you read through 1. Brief Tour of E-Cell4 Simulations, it is NOT difficult to use World and Simulato... |
OpenWeavers/openanalysis | doc/OpenAnalysis/02 - Sorting.ipynb | gpl-3.0 | x = list(range(10))
import random
random.shuffle(x)
x
sorted(x)
import math
y = sorted(x,key = lambda x: math.sin(x)) # Sort elements of x in increasing order of their sines
y
[math.sin(i) for i in y]
"""
Explanation: Sorting Analysis
Consider a finite collection of orderable elements. Re-arranging that collecti... |
phoebe-project/phoebe2-docs | 2.3/tutorials/saving_and_loading.ipynb | gpl-3.0 | #!pip install -I "phoebe>=2.3,<2.4"
import phoebe
from phoebe import u # units
import numpy as np
import matplotlib.pyplot as plt
logger = phoebe.logger(clevel='INFO')
b = phoebe.default_binary()
"""
Explanation: Advanced: Saving, Loading, and Exporting
Setup
Let's first make sure we have the latest version of PHOE... |
gcgruen/homework | data-databases-homework/Homework_6_Gruen.ipynb | mit | import requests
data = requests.get('http://localhost:5000/lakes').json()
print(len(data), "lakes")
for item in data[:10]:
print(item['name'], "- elevation:", item['elevation'], "m / area:", item['area'], "km^2 / type:", item['type'])
"""
Explanation: Homework 6: Web Applications
For this homework, you're going to... |
matsuyamax/Recipes | examples/spatial_transformer_network.ipynb | mit | !wget -N https://s3.amazonaws.com/lasagne/recipes/datasets/mnist_cluttered_60x60_6distortions.npz
def load_data():
data = np.load(mnist_cluttered)
X_train, y_train = data['x_train'], np.argmax(data['y_train'], axis=-1)
X_valid, y_valid = data['x_valid'], np.argmax(data['y_valid'], axis=-1)
X_test, y_te... |
kubeflow/examples | jpx-tokyo-stock-exchange-kaggle-competition/jpx-tokyo-stock-exchange-prediction-orig.ipynb | apache-2.0 | !pip install -r requirements.txt --user --quiet
"""
Explanation: JPX Tokyo Stock Exchange Original Notebook
In this Kaggle competition
Japan Exchange Group, Inc. (JPX) is a holding company operating one of the largest stock exchanges in the world, Tokyo Stock Exchange (TSE), and derivatives exchanges Osaka Exchange ... |
danresende/deep-learning | autoencoder/Convolutional_Autoencoder.ipynb | mit | %matplotlib inline
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', validation_size=0)
img = mnist.train.images[2]
plt.imshow(img.reshape((28, 28)), cmap='Greys_r')
"""
Explanation: C... |
google/starthinker | colabs/policebot.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: PoliceBot
A tool that helps enforce CM object name conventions by checking names against a set of client-defined patterns, and emailing violations to appropriate agency teams on a daily basis.
License
Copyright 2020 Google LLC,
Licensed under the... |
QuantumTechDevStudio/RUDNEVGAUSS | invariance_testing/Step_I/linear_regression_test_3.ipynb | gpl-3.0 | import numpy as np
import tensorflow as tf
from matplotlib import pylab as plt
%matplotlib inline
m = 4500
M = 4
a = -10
b = 10
x_grid = np.linspace(a, b, m, endpoint=True)
sess = tf.Session()
x = tf.placeholder(tf.double)
trial_func = [tf.sin(x), tf.cos(x), tf.sin(2*x), tf.cos(2*x)]
alpha = tf.Variable(1, dtype=t... |
fonnesbeck/baseball | notebooks/Retrosheet.ipynb | mit | DATA_DIR = '../data'
import glob
event_files = glob.glob("{}/*seve/*.EV*".format(DATA_DIR))
"""
Explanation: Data import
Assumes data is in DATA_DIR and includes the directory and file structure of data as downloaded from retrosheet.org.
End of explanation
"""
years = list(range(2010, 2016))
year_files = [f for f... |
TeamProgramming/testsPy | RSA.ipynb | mit | d, n = 17,403 # закрытый ключ
D = lambda c: (pow(c,d))%n # расшифрование
"""
Explanation: $$ E(m) = m^e (mod(n)) $$
End of explanation
"""
p, q = 23, 17
phi(n)
"""
Explanation: $$ D(c) = c^d (mod(n)) $$
End of explanation
"""
print ( (e*d)%phi(n))
e*d
"""
Explanation: $$ p(360) = p(40)p(9) = 6p(5)p(8) = 64*4 = ... |
vega/ipython-vega | notebooks/Widget.ipynb | bsd-3-clause | from vega import VegaLite
VegaLite(spec=spec_with_data)
"""
Explanation: Static Vega Plot
End of explanation
"""
from vega.widget import VegaWidget
widget = VegaWidget(spec=spec_no_data)
values = [
dict(
x=random.gauss(0.0, 1.0),
y=random.gauss(0.0, 1.0),
t=0,
)
for _ in range(... |
manmax31/MaterialRecognition | src/Others/Neural-Networks-with-Caffe-on-the-GPU.ipynb | apache-2.0 | import subprocess
import platform
import sys
sys.path.append("/Users/manabchetia/Downloads/caffe/python/")
import caffe
caffe.set_mode_gpu()
import lmdb
from sklearn.cross_validation import StratifiedShuffleSplit
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanati... |
DistrictDataLabs/yellowbrick | examples/bbengfort/corpus.ipynb | apache-2.0 | %matplotlib inline
import os
import sys
import nltk
import pickle
# To import yellowbrick
sys.path.append("../..")
"""
Explanation: Visual Diagnosis of Text Analysis with Baleen
This notebook has been created as part of the Yellowbrick user study. I hope to explore how visual methods might improve the workflow o... |
grokkaine/biopycourse | day1/languages.ipynb | cc0-1.0 | import readline
import rpy2.robjects as robjects
robjects.r('''
source("http://www.bioconductor.org/biocLite.R")
biocLite("ALL")
library("ALL")
data("ALL")
#install.packages("gplots")
eset <- ALL[, ALL$mol.biol %in% c("BCR/ABL", "ALL1/AF4")]
library("limma")
f <- factor(as.character(eset$mol.biol))
design <- model.mat... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/time_series_prediction/labs/optional_2_feature_engineering.ipynb | apache-2.0 | PROJECT = 'your-gcp-project' # Replace with your project ID.
import pandas as pd
from google.cloud import bigquery
from IPython.core.magic import register_cell_magic
from IPython import get_ipython
bq = bigquery.Client(project = PROJECT)
# Allow you to easily have Python variables in SQL query.
@register_cell_magi... |
jfconavarrete/kaggle-facebook | notebooks/.ipynb_checkpoints/1.0-toni-preprocessing-checkpoint.ipynb | mit | train_X = train.values[:,:-1]
train_t = train.values[:,-1]
print train_X.shape
print train_t.shape
train.describe()
train.head()
train.tail()
"""
Explanation: The number of unique values is huge. This makes me think in a direction where we could center basis functions at the centers of discovered clusters. Discove... |
JaviMerino/lisa | ipynb/android/workloads/Android_Recents_Fling.ipynb | apache-2.0 | import logging
reload(logging)
log_fmt = '%(asctime)-9s %(levelname)-8s: %(message)s'
logging.basicConfig(format=log_fmt)
# Change to info once the notebook runs ok
logging.getLogger().setLevel(logging.INFO)
%pylab inline
import os
from time import sleep
# Support to access the remote target
import devlib
from env ... |
jabelone/Unearthed2017 | tensorflowstuffmyles/FeaturesData.ipynb | gpl-3.0 | trainingX = features[:100]
trainingY = target[:100]
testX = features[200:300]
testY = target[200:300]
"""
Explanation: Split the Features and Targets into Training and Test Sets
End of explanation
"""
clf = svm.SVR()
clf.fit(trainingX, trainingY)
predictions = clf.predict(testX)
"""
Explanation: 🤖 Machine Learnin... |
bizreach/common-ml | common/notebook/skchainer/dnn_autoencoder_iris.ipynb | apache-2.0 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import random
from sklearn.pipeline import Pipeline
from chainer import optimizers
from commonml.skchainer import MeanSquaredErrorRegressor, AutoEncoder
from tensorflow.contrib.learn import datasets
import ... |
PyladiesMx/Empezando-con-Python | 2. Lists_and_conditionals/lists and conditionals.ipynb | mit | lista1 = ["Hola", 1, 2.0, True]
lista1
lista2 = [2+3, 5+1, 4**2]
lista2
"""
Explanation: ¡Bienvenidas nuevamente!
Hoy veremos otro tipo de objetos en python llamados listas y además empezaremos a tomar decisiones con expresiones condicionales.
¿Y qué pasa si queremos coleccionar valores? Acerca de las listas...
En ... |
brclark-usgs/flopy | examples/Notebooks/flopy3_export.ipynb | bsd-3-clause | from __future__ import print_function
import os
import sys
import flopy
print(sys.version)
print('flopy version: {}'.format(flopy.__version__))
"""
Explanation: FloPy
Demo of netCDF and shapefile export capabilities within the flopy export module.
End of explanation
"""
nam_file = "freyberg.nam"
model_ws = os.path.... |
bayesimpact/bob-emploi | data_analysis/notebooks/datasets/rome/update_from_v330_to_v331.ipynb | gpl-3.0 | import collections
import glob
import os
from os import path
import matplotlib_venn
import pandas
rome_path = path.join(os.getenv('DATA_FOLDER'), 'rome/csv')
OLD_VERSION = '330'
NEW_VERSION = '331'
old_version_files = frozenset(glob.glob(rome_path + '/*{}*'.format(OLD_VERSION)))
new_version_files = frozenset(glob.g... |
mne-tools/mne-tools.github.io | 0.23/_downloads/cfb7e81b0726506eff73163a3264a673/mne_inverse_label_connectivity.ipynb | bsd-3-clause | # Authors: Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Nicolas P. Rougier (graph code borrowed from his matplotlib gallery)
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
f... |
tonynishimura/Simulacion2017 | Modulo1/Clase5_OsciladorAmortiguado.ipynb | mit | # Primero importamos todas las librerias, paquetes y/o funciones que vamos a utlizar
import matplotlib.pyplot as plt # ¿Para qué sirve?
import numpy as np # ¿Para qué sirve?
from scipy.integrate import odeint # Función para integrar EDO vectoriales de primer orden
%matplotlib inline ... |
cinai/identification-algorithms | algoritmo_1/The test after tomorrow.ipynb | mit | %matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import time
import pickle
from __future__ import division
import csv
from tools import *
import os
reload(tpm_identification)
data_path = os.path.join(os.getcwd(),'..','data')
first_period_path = os.path.join(data_path,'Users_da... |
isendel/machine-learning | ml-regression/week1-2/week-2-multiple-regression-assignment-1-blank.ipynb | apache-2.0 | import numpy as np
import pandas as pd
%matplotlib inline
"""
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... |
thomasantony/CarND-Projects | Exercises/Term1/TensorFlow-Tutorials/12_Adversarial_Noise_MNIST.ipynb | mit | from IPython.display import Image
Image('images/12_adversarial_noise_flowchart.png')
"""
Explanation: TensorFlow Tutorial #12
Adversarial Noise for MNIST
by Magnus Erik Hvass Pedersen
/ GitHub / Videos on YouTube
Introduction
The previous Tutorial #11 showed how to find so-called adversarial examples for a state-of-th... |
gaufung/ISL | Chapter02.ipynb | mit | import pandas as pd
college_file_name = 'data/College.csv'
college = pd.read_csv(college_file_name,index_col=0)
college
college.describe()
import matplotlib.pyplot as plt
column_10 = college.columns[-10:]
def getColumns(idx):
values = college[column_10[idx]]
return [item for item in values]
for row in range(1... |
haltux/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... |
eds-uga/csci1360-fa16 | assignments/A3/A3_Q4.ipynb | mit | import numpy as np
np.testing.assert_allclose(27.0, cube(3.0))
np.testing.assert_allclose(125.0, cube(5.0))
np.testing.assert_allclose(1000.0, cube(10.0))
"""
Explanation: Q4
Writing functions!
A
Write a function that computes the cube of a number.
named cube
takes 1 argument, a number
returns 1 number, the cube (thi... |
sharafcode/EM-Algorithm-for-Text-clustering-using-sickit-learn- | Computing Heterogeneity and clustering with KMeans++.ipynb | mit | from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans
from sklearn.metrics import adjusted_rand_score
from sklearn.metrics.pairwise import pairwise_distances_argmin, euclidean_distances , pairwise_distances
import pandas as pd
import matplotlib.pyplot as plt
import nltk
import n... |
dtamayo/MachineLearning | Day1/Presentation_05_model_evaluation.ipynb | gpl-3.0 | # read in the iris data
from sklearn.datasets import load_iris
iris = load_iris()
# create X (features) and y (response)
X = iris.data
y = iris.target
"""
Explanation: Testing a Model
Based on Kevin Markham's video series: Introduction to machine learning with scikit-learn
jupyter notebook 05_model_evaluation_ta.ipyn... |
xpharry/Udacity-DLFoudation | tutorials/tensorboard/Anna KaRNNa Summaries.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
kubeflow/examples | mnist/mnist_ibm.ipynb | apache-2.0 | cos_credentials = {
"apikey": "-------",
"cos_hmac_keys": {
"access_key_id": "------",
"secret_access_key": "------"
},
"endpoints": "https://cos-service.bluemix.net/endpoints",
"iam_apikey_description": "------",
"iam_apikey_name": "------",
"iam_role_crn": "------",
"iam_serviceid_crn": "-----... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive/02_tensorflow/labs/b_tfstart_graph.ipynb | apache-2.0 | import tensorflow as tf
print(tf.__version__)
"""
Explanation: Getting started with TensorFlow (Graph Mode)
Learning Objectives
- Understand the difference between Tensorflow's two modes: Eager Execution and Graph Execution
- Get used to deferred execution paradigm: first define a graph then run it in a tf.Session... |
jankoslavic/py-tools | wrapping C code/Compiling C with mingw-w64 and wrapping it with ctypes in Python 3.4.ipynb | mit | !!gcc -c sample.c
!!gcc -shared -o sample.dll sample.o -Wl,--out-implib,libsample.a
"""
Explanation: Compiling C code to dll
Look at the sample.c and sample.h files for C code and header, respectively.
Install mingw-w64 from:
http://sourceforge.net/projects/mingw-w64/
put mingw64\bin\ folder into path and compile it ... |
pycomlink/pycomlink | notebooks/outdated_notebooks/Spatial interpolation.ipynb | bsd-3-clause | %matplotlib inline
import pycomlink as pycml
import matplotlib.pyplot as plt
from tqdm import tqdm
"""
Explanation: Table of Contents
<p><div class="lev1 toc-item"><a href="#Load-CML-example-data" data-toc-modified-id="Load-CML-example-data-1"><span class="toc-item-num">1 </span>Load CML example data</a><... |
eds-uga/csci1360-fa16 | assignments/A11/A11_Q1.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import sklearn.datasets as datasets
import seaborn as sns
iris = datasets.load_iris()
### BEGIN SOLUTION
### END SOLUTION
"""
Explanation: Q1
In this question, you'll design a very simple classifier to work on a real-world dataset.
The iris datas... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.