repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
kylemede/DS-ML-sandbox
notebooks/.ipynb_checkpoints/CS_and_Python-checkpoint.ipynb
gpl-3.0
for _ in xrange(10): print "Do something" """ Explanation: xrange vs range looping For long for loops with no need to track iteration use: End of explanation """ for i in range(1,10): vars()['x'+str(i)] = i """ Explanation: This will loop through 10 times, but the iteration variable won't be unused as it wa...
QInfer/qinfer-examples
custom_distributions.ipynb
agpl-3.0
from __future__ import division %matplotlib inline import numpy as np import matplotlib.pyplot as plt try: plt.style.use('ggplot') except: pass """ Explanation: Making Custom Distributions Introduction By using the InterpolatedUnivariateDistribution class, you can easily create a single-variable distribution by speci...
w4zir/ml17s
lectures/.ipynb_checkpoints/lec04-multinomial-regression-checkpoint.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np from sklearn import linear_model import matplotlib.pyplot as plt # read data in pandas frame dataframe = pd.read_csv('datasets/example1.csv', encoding='utf-8') # assign x and y X = np.array(dataframe[['x']]) y = np.array(dataframe[['y']]) m = y.size # number ...
mbeyeler/opencv-machine-learning
notebooks/10.02-Combining-Decision-Trees-Into-a-Random-Forest.ipynb
mit
from sklearn.datasets import make_moons X, y = make_moons(n_samples=100, noise=0.25, random_state=100) import matplotlib.pyplot as plt %matplotlib inline plt.style.use('ggplot') plt.figure(figsize=(10, 6)) plt.scatter(X[:, 0], X[:, 1], s=100, c=y) plt.xlabel('feature 1') plt.ylabel('feature 2'); """ Explanation: <!-...
charlesreid1/empirical-model-building
ipython/Factorial - Two-Level Three-Factor Design.ipynb
mit
import pandas as pd import numpy as np from numpy.random import rand """ Explanation: A Two-Level, Three-Factor Full Factorial Design <br /> <br /> <br /> Table of Contents Introduction Factorial Experimental Design: Two-Level Three-Factor Full Factorial Design Design of the Experiment Inputs and Responses Effects an...
zzsza/Datascience_School
30. 딥러닝/03. 신경망 성능 개선.ipynb
mit
sigmoid = lambda x: 1/(1+np.exp(-x)) sigmoid_prime = lambda x: sigmoid(x)*(1-sigmoid(x)) xx = np.linspace(-10, 10, 1000) plt.plot(xx, sigmoid(xx)); plt.plot(xx, sigmoid_prime(xx)); """ Explanation: 신경망 성능 개선 신경망의 예측 성능 및 수렴 성능을 개선하기 위해서는 다음과 같은 추가적인 고려를 해야 한다. 오차(목적) 함수 개선: cross-entropy cost function 정규화: regulariza...
bspalding/research_public
lectures/drafts/Multiple linear regression.ipynb
apache-2.0
# Import the libraries we'll be using import numpy as np import statsmodels.api as sm # If the observations are in a dataframe, you can use statsmodels.formulas.api to do the regression instead from statsmodels import regression import matplotlib.pyplot as plt # Construct and plot series X1 = np.arange(100) X2 = np.ar...
liganega/Gongsu-DataSci
previous/notes2017/W10/GongSu23_Statistics_Correlation.ipynb
gpl-3.0
from GongSu22_Statistics_Population_Variance import * """ Explanation: 자료 안내: 여기서 다루는 내용은 아래 사이트의 내용을 참고하여 생성되었음. https://github.com/rouseguy/intro2stats 상관분석 안내사항 지난 시간에 다룬 21장과 22장 내용을 활용하고자 한다. 따라서 아래와 같이 21장과 22장 내용을 모듈로 담고 있는 파이썬 파일을 임포트 해야 한다. 주의: 아래 두 개의 파일이 동일한 디렉토리에 위치해야 한다. * GongSu21_Statistics_Averages.py ...
lin99/NLPTM-2016
4.Docs/assign1.ipynb
mit
# import word2vec model from gensim from gensim.models.word2vec import Word2Vec # load pre-trained model model = Word2Vec.load_word2vec_format('eswikinews.bin', binary=True) """ Explanation: NLP and TM Módulo 4 Taller 1: word2vec Nombres: Obtenga el archivo del modelo word2vec entrenado con WikiNews en Español: eswiki...
flaviobarros/spyre
tutorial/pydata2015_seattle/pydata2015_seattle.ipynb
mit
from spyre import server class SimpleApp(server.App): title = "Simple App" app = SimpleApp() app.launch() # launching from ipython notebook is not recommended """ Explanation: twitter: @adamhajari github: github.com/adamhajari/spyre this notebook: http://bit.ly/pydata2015_spyre Before we start make sure you ha...
igabr/Metis_Projects_Chicago_2017
03-Project-McNulty/feature_reduction_35.ipynb
mit
df = unpickle_object("dummied_dataset.pkl") df.shape #this logic will be important for flask data entry. float_columns = df.select_dtypes(include=['float64']).columns for col in float_columns: if "mths" not in col: df[col].fillna(df[col].median(), inplace=True) else: if col == "inq_last_6mth...
jbwhit/jupyter-tips-and-tricks
notebooks/08-old.ipynb
mit
df2 = df[df['Mine_State'] != "Wyoming"].groupby('Mine_State').sum() df3 = df.groupby('Mine_State').sum() # have to run this from the home dir of this repo # cd insight/ # python setup.py develop %aimport insight.plotting insight.plotting.plot_prod_vs_hours(df3, color_index=1) # insight.plotting.plot_prod_vs_hours(d...
jdhp-docs/python-notebooks
python_re.ipynb
mit
s = "Maison 3 pièce(s) - 68.05 m² - 860 € par mois charges comprises" re.findall(r'\d+\.?\d*', s) re.findall(r'\b\d+\.?\d*\b', s) """ Explanation: Extract numbers from a string End of explanation """ s = "Maison 3 pièce(s) - 68.05 m² - 860 € par mois charges comprises" if re.search(r'Maison', s): print("Found...
CompPhysics/MachineLearning
doc/pub/week38/ipynb/week38.ipynb
cc0-1.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import KFold from sklearn.linear_model import Ridge from sklearn.model_selection import cross_val_score from sklearn.preprocessing import PolynomialFeatures # A seed just to ensure that the random numbers are the same f...
cmorgan/toyplot
docs/table-axes.ipynb
bsd-3-clause
import numpy import toyplot.data data_table = toyplot.data.read_csv("temperatures.csv") data_table = data_table[:10] """ Explanation: .. _table-axes: Table Axes Data tables, with rows containing observations and columns containing variables or series, are arguably the cornerstone of science. Much of the functionality...
Unidata/unidata-python-workshop
notebooks/Metpy_Introduction/Introduction to MetPy.ipynb
mit
# Import the MetPy unit registry from metpy.units import units length = 10.4 * units.inches width = 20 * units.meters print(length, width) """ Explanation: <div style="width:1000 px"> <div style="float:right; width:98 px; height:98px;"> <img src="https://raw.githubusercontent.com/Unidata/MetPy/master/metpy/plots/_st...
eshlykov/mipt-day-after-day
statistics/hw-11/11.7-9.ipynb
unlicense
import numpy import scipy.stats n = 800 # Размер выборки mu = numpy.array([74, 92, 83, 79, 80, 73, 77, 75, 76, 91]) expected = n * numpy.full(10, 0.1) """ Explanation: Задача 11.7 Цифры $0, 1, 2, \ldots, 9$ среди $800$ первых десятичных знаков числа $\pi$ появились $74, 92, 83, 79, 80, 73, 77, 75, 76, 91$ раз соотв...
geoneill12/phys202-2015-work
assignments/assignment04/MatplotlibEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 1 Imports End of explanation """ import os assert os.path.isfile('yearssn.dat') """ Explanation: Line plot of sunspot data Download the .txt data for the "Yearly mean total sunspot number [1700 - now]" from th...
ahwillia/RecNetLearn
tutorials/FORCE_Learning_recurrent_feedforward.ipynb
mit
from __future__ import division from scipy.integrate import odeint,ode from numpy import zeros,ones,eye,tanh,dot,outer,sqrt,linspace,pi,exp,tile,arange,reshape from numpy.random import uniform,normal,choice import pylab as plt import numpy as np %matplotlib inline """ Explanation: Embedding a Feedforward Cascade in a ...
gourie/training_RL
gym_ex_taxi.ipynb
bsd-3-clause
env = gym.make("Taxi-v2") env.reset() # init state value of env env.observation_space.n # number of possible values in this state space env.action_space.n # number of possible actions # print(env.action_space) # 0 = down # 1 = up # 2 = right # 3 = left # 4 = pickup # 5 = drop-off env.render() # In this enviro...
darkomen/TFG
medidas/03082015/.ipynb_checkpoints/modelado-checkpoint.ipynb
cc0-1.0
#Importamos las librerías utilizadas import numpy as np import pandas as pd import seaborn as sns from scipy import signal #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__)) %pylab inlin...
claudiuskerth/PhDthesis
Data_analysis/SNP-indel-calling/dadi/05_1D_model_synthesis.ipynb
mit
# load dadi module import sys sys.path.insert(0, '/home/claudius/Downloads/dadi') import dadi %ll %ll dadiExercises # import 1D spectrum of ery fs_ery = dadi.Spectrum.from_file('dadiExercises/ERY.FOLDED.sfs.dadi_format') # import 1D spectrum of ery fs_par = dadi.Spectrum.from_file('dadiExercises/PAR.FOLDED.sfs.d...
madHatter106/DataScienceCorner
posts/xarray-geoviews-a-new-perspective-on-oceanographic-data-part-ii.ipynb
mit
import xarray as xr import os import glob """ Explanation: In a previous post, I introduced xarray with some simple manipulation and data plotting. In this super-short post, I'm going to do some more manipulation, using multiple input files to create a new dimension, reorganize the data and store them in multiple outp...
llvll/motionml
ip[y]/motionml.ipynb
bsd-2-clause
from tinylearn import KnnDtwClassifier from tinylearn import CommonClassifier import pandas as pd import numpy as np import os train_labels = [] test_labels = [] train_data_raw = [] train_data_hist = [] test_data_raw = [] test_data_hist = [] # Utility function for normalizing numpy arrays def normalize(v): norm =...
DiXiT-eu/collatex-tutorial
unit8/unit8-collatex-and-XML/Custom sort.ipynb
gpl-3.0
import re """ Explanation: Defining a custom sort for a complex value We need to sort data that is partially numeric and partially alphabetic, in this case the line numbers 1, 4008, 4008a, 4009, and 9. We can’t sort them numerically because the 'a' isn’t numeric. And we can’t sort them alphabetically because the numbe...
nproctor/phys202-2015-work
assignments/assignment04/MatplotlibEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Matplotlib Exercise 2 Imports End of explanation """ !head -n 30 open_exoplanet_catalogue.txt """ Explanation: Exoplanet properties Over the past few decades, astronomers have discovered thousands of extrasolar planets. The follo...
hiteshagrawal/python
udacity/nano-degree/.ipynb_checkpoints/L1_Starter_Code-checkpoint.ipynb
gpl-2.0
import unicodecsv ## Longer version of code (replaced with shorter, equivalent version below) # enrollments = [] # f = open('enrollments.csv', 'rb') # reader = unicodecsv.DictReader(f) # for row in reader: # enrollments.append(row) # f.close() def readme(filename): with open(filename, 'rb') as f: rea...
quantumlib/Cirq
docs/qubits.ipynb
apache-2.0
try: import cirq except ImportError: print("installing cirq...") !pip install --quiet cirq print("installed cirq.") import cirq """ Explanation: Qubits <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://quantumai.google/cirq/qubits"><img src="https://quant...
timothydmorton/VESPA
notebooks/predictions.ipynb
mit
from keputils import kicutils as kicu stars = kicu.DATA # This is Q17 stellar table. """ Explanation: The question to explore is the following: given Kepler observations, how many events of the following type are we likely to observe as single eclipse events? EBs BEBs HEBs More specifically, given a period and depth...
bill9800/House-Prediciton
HousePrediction.ipynb
mit
#missing data total = df_train.isnull().sum().sort_values(ascending = False) percent = (df_train.isnull().sum()/df_train.isnull().count()).sort_values(ascending = False) missing_data = pd.concat([total,percent],axis=1,keys=['Total','Percent']) missing_data.head(25) # In the search for normality sns.distplot(df_train[...
brian-rose/climlab
docs/source/courseware/Reset-time.ipynb
mit
import numpy as np import climlab climlab.__version__ """ Explanation: Resetting time to zero after cloning a climlab process Brian Rose, 2/15/2022 Here are some notes on how to reset a model's internal clock to zero after cloning a process with climlab.process_like() These notes may become out of date after the next ...
fluffy-hamster/A-Beginners-Guide-to-Python
A Beginners Guide to Python/26. Design Decisions, How to Build Chess Game.ipynb
mit
# One use, "throw away" code: def one_to_one_hundred(): for i in range(1, 101): print (i) # Multi use, 'generalised' code: def n_to_x(n, m): for i in range(n, m+1): print(i) """ Explanation: Features of Good Design Hi guys, this lecture is a bit different, today we are mostly glossing ...
Lattecom/HYStudy
scripts/[HYStudy 15th] Matplotlib 2.ipynb
mit
# make point with cumulative sum points = np.random.randn(50).cumsum() points """ Explanation: Magic Command %matplotlib inline: show() 생략 %matplotlib qt: 외부창 출력 End of explanation """ # plt.plot(x, y): x, y = point(x, y) on coordinate # put y only(default x = auto) plt.plot(points) plt.show() # put x and y points...
kingb12/languagemodelRNN
old_comparisons/testcompare.ipynb
mit
report_files = ["/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing6_200_512_04drb/encdec_noing6_200_512_04drb.json", "/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing6_bow_200_512_04drb/encdec_noing6_bow_200_512_04drb.json"] log_files = ["/Users/bking/IdeaProjects/Lang...
Vvkmnn/books
AutomateTheBoringStuffWithPython/lesson22.ipynb
gpl-3.0
#! usr/bin/env bash # This is a shell script #python3 runthisscript.py #echo 'I'm running a python script' """ Explanation: Lesson 22: Launching Python in Other Programs The first line of any Pthon Script should be the Shebang Line. OSX: #! /usr/bin/env python3 Linux: #! usr/bin/python3 Windows: python3 This ...
dalonlobo/GL-Mini-Projects
TweetAnalysis/Final/Q7/Dalon_4_RTD_MiniPro_Tweepy_Q7.ipynb
mit
import logging # python logging module # basic format for logging logFormat = "%(asctime)s - [%(levelname)s] (%(funcName)s:%(lineno)d) %(message)s" # logs will be stored in tweepy.log logging.basicConfig(filename='tweepyretweet.log', level=logging.INFO, format=logFormat, datefmt="%Y-%m-%d %H:%M:%S...
PySCeS/PyscesToolbox
example_notebooks/RateChar.ipynb
bsd-3-clause
mod = pysces.model('lin4_fb.psc') rc = psctb.RateChar(mod) """ Explanation: RateChar RateChar is a tool for performing generalised supply-demand analysis (GSDA) [5,6]. This entails the generation data needed to draw rate characteristic plots for all the variable species of metabolic model through parameter scans and t...
nicococo/scRNA
notebooks/example.ipynb
mit
import numpy as np import matplotlib.pyplot as plt %matplotlib inline from functools import partial from sklearn.manifold import TSNE import sklearn.metrics as metrics from scRNA.simulation import generate_toy_data, split_source_target from scRNA.nmf_clustering import NmfClustering_initW, NmfClustering, DaNmfCluste...
kidpixo/multibinner
examples/example_multibinner.ipynb
mit
image_df = pd.DataFrame(image.reshape(-1,image.shape[-1]),columns=['red','green','blue']) image_df.describe() n_data = image.reshape(-1,image.shape[-1]).shape[0]*10 # 10 times the original number of pixels : overkill! x = np.random.random_sample(n_data)*image.shape[1] y = np.random.random_sample(n_data)*image.shape[0]...
mne-tools/mne-tools.github.io
0.15/_downloads/plot_source_power_spectrum.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample from mne.minimum_norm import read_inverse_operator, compute_source_psd print(__doc__) """ Explanation: Compute power spect...
ContinuumIO/pydata-apps
Section_1_blaze_solutions.ipynb
mit
import pandas as pd df = pd.read_csv('iris.csv') df.head() df.groupby(df.Species).PetalLength.mean() # Average petal length per species """ Explanation: <img src="images/continuum_analytics_logo.png" alt="Continuum Logo", align="right", ...
mne-tools/mne-tools.github.io
0.23/_downloads/ca1574468d033ed7a4e04f129164b25b/20_cluster_1samp_spatiotemporal.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Eric Larson <larson.eric.d@gmail.com> # License: BSD (3-clause) import os.path as op import numpy as np from numpy.random import randn from scipy import stats as stats import mne from mne.epochs import equalize_epoch_counts from mne.stats import ...
ffmmjj/intro_to_data_science_workshop
solutions/en_US/04-Example: Titanic survivors analysis.ipynb
apache-2.0
import pandas as pd raw_data = pd.read_csv('datasets/titanic.csv') raw_data.head() raw_data.info() """ Explanation: Titanic survival analysis The Titanic survivors dataset is popularly used to illustrate concepts of data cleaning and exploration. Let's start by importing the data to a pandas DataFrame from a CSV fi...
patrickbreen/patrickbreen.github.io
notebooks/vae_my_version.ipynb
mit
import sys import os import numpy as np import tensorflow as tf import matplotlib.pyplot as plt %matplotlib inline np.random.seed(0) tf.set_random_seed(0) # get the script bellow from # https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/mnist/input_data.py import input_data mnist =...
guyk1971/deep-learning
sentiment-rnn/Sentiment_RNN.ipynb
mit
import numpy as np import tensorflow as tf with open('../sentiment-network/reviews.txt', 'r') as f: reviews = f.read() with open('../sentiment-network/labels.txt', 'r') as f: labels = f.read() reviews[:2000] """ Explanation: Sentiment Analysis with an RNN In this notebook, you'll implement a recurrent neural...
sailuh/perceive
Notebooks/CWE/Fielder_Parser/Legacy CWE Field Parser.ipynb
gpl-2.0
tree = lxml.etree.parse('cwec_v3.0.xml') root = tree.getroot() # Remove namespaces from XML. for elem in root.getiterator(): if not hasattr(elem.tag, 'find'): continue # (1) i = elem.tag.find('}') # Counts the number of characters up to the '}' at the end of the XML namespace within the XML tag if i >=...
AllenDowney/ProbablyOverthinkingIt
falsepos.ipynb
mit
from __future__ import print_function, division import thinkbayes2 from sympy import symbols """ Explanation: Exploration of a problem interpreting binary test results Copyright 2015 Allen Downey MIT License End of explanation """ p, q, s, t1, t2 = symbols('p q s t1 t2') """ Explanation: p is the prevalence of a ...
mne-tools/mne-tools.github.io
0.22/_downloads/3674b896fc4e4a279156fa5c0f61aea8/plot_10_preprocessing_overview.ipynb
bsd-3-clause
import os import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) raw.crop(0, 60).load_data() # just use a fr...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/tensorflow_extended/solutions/Simple_TFX_Pipeline_for_Vertex_Pipelines.ipynb
apache-2.0
# Use the latest version of pip. !pip install --upgrade pip !pip install --upgrade "tfx[kfp]<2" """ Explanation: Creating Simple TFX Pipeline for Vertex Pipelines Learning objectives Prepare example data. Create a pipeline. Run the pipeline on Vertex Pipelines. Introduction In this notebook, you will create a simple...
emsi/ml-toolbox
random/Atmosfera/MODEL-11-conv.ipynb
agpl-3.0
# Dane wejściowe with open("X-sequences.pickle", 'rb') as f: X = pickle.load(f) with open("Y.pickle", 'rb') as f: Y = pickle.load(f) # Zostaw tylko poniższe kategorie, pozostale zmień na -1 lista = [2183, #325, 37, 859, 2655, 606, 412, 2729, 1683, 1305] # Y=[y if y in lista else -1 for...
KMFleischer/PyEarthScience
Tutorial/04_PyNGL_basics.ipynb
mit
import Ngl """ Explanation: 4. PyNGL basics PyNGL is a Python language module for creating 2D high performance visualizations of scientific data. It is based on NCL graphics but still not as extensive as NCL's last version 6.6.2. The aim of this notebook is to give you an introduction to PyNGL, read your data from fil...
satishgoda/learning
web/html.ipynb
mit
from IPython.display import HTML, Javascript HTML("Hello World") """ Explanation: HTML and w3 Schools End of explanation """ !gvim draggable_1.html HTML('./draggable_1.html') """ Explanation: Supporting Technologies jQuery Examples Draggable Elements https://www.w3schools.com/tags/att_global_draggable.asp http...
mathinmse/mathinmse.github.io
Lecture-13-Integral-Transforms.ipynb
mit
import sympy as sp sp.init_printing(use_latex=True) # symbols we will need below x,y,z,t,c = sp.symbols('x y z t c') # note the special declaration that omega is a positive number omega = sp.symbols('omega', positive=True) """ Explanation: Lecture 13: Integral Transforms, D/FFT and Electron Microscopy Background A...
kubeflow/pipelines
components/gcp/dataproc/submit_hive_job/sample.ipynb
apache-2.0
%%capture --no-stderr !pip3 install kfp --upgrade """ Explanation: Name Data preparation using Apache Hive on YARN with Cloud Dataproc Label Cloud Dataproc, GCP, Cloud Storage, YARN, Hive, Apache Summary A Kubeflow Pipeline component to prepare data by submitting an Apache Hive job on YARN to Cloud Dataproc. Details ...
mne-tools/mne-tools.github.io
dev/_downloads/9e70404d3a55a6b6d1c1877784347c14/mixed_source_space_inverse.ipynb
bsd-3-clause
# Author: Annalisa Pascarella <a.pascarella@iac.cnr.it> # # License: BSD-3-Clause import os.path as op import matplotlib.pyplot as plt from nilearn import plotting import mne from mne.minimum_norm import make_inverse_operator, apply_inverse # Set dir data_path = mne.datasets.sample.data_path() subject = 'sample' da...
slundberg/shap
notebooks/image_examples/image_classification/Explain MobilenetV2 using the Partition explainer (PyTorch).ipynb
mit
import json import numpy as np import torchvision import torch import torch.nn as nn import shap from PIL import Image """ Explanation: Explain PyTorch MobileNetV2 using the Partition explainer In this example we are explaining the output of MobileNetV2 for classifying images into 1000 ImageNet classes. End of explana...
fsilva/deputado-histogramado
notebooks/Deputado-Histogramado-5.ipynb
gpl-3.0
%matplotlib inline import pylab import matplotlib import pandas import numpy dateparse = lambda x: pandas.datetime.strptime(x, '%Y-%m-%d') sessoes = pandas.read_csv('sessoes_democratica_org.csv',index_col=0,parse_dates=['data'], date_parser=dateparse) del sessoes['tamanho'] total0 = numpy.sum(sessoes['sessao'].m...
jinntrance/MOOC
coursera/ml-clustering-and-retrieval/assignments/2_kmeans-with-text-data_blank.ipynb
cc0-1.0
import graphlab import matplotlib.pyplot as plt import numpy as np import sys import os from scipy.sparse import csr_matrix %matplotlib inline '''Check GraphLab Create version''' from distutils.version import StrictVersion assert (StrictVersion(graphlab.version) >= StrictVersion('1.8.5')), 'GraphLab Create must be ve...
GoogleCloudPlatform/mlops-on-gcp
environments_setup/mlops-composer-mlflow/caip-training-test.ipynb
apache-2.0
import os import re from IPython.core.display import display, HTML from datetime import datetime import mlflow import pymysql # Jupyter magic template to create Python file with variable substitution from IPython.core.magic import register_line_cell_magic @register_line_cell_magic def writetemplate(line, cell): w...
bretthandrews/marvin
docs/sphinx/jupyter/my-first-query.ipynb
bsd-3-clause
# Python 2/3 compatibility from __future__ import print_function, division, absolute_import from marvin import config config.mode = 'remote' config.setRelease('MPL-4') from marvin.tools.query import Query """ Explanation: My First Query One of the most powerful features of Marvin 2.0 is ability to query the newly cr...
samuelshaner/openmc
docs/source/pythonapi/examples/mgxs-part-ii.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import openmoc from openmoc.opencg_compatible import get_openmoc_geometry import openmc import openmc.mgxs as mgxs import openmc.data %matplotlib inline """ Explanation: This IPython Notebook illustrates the use of the openmc.mgxs module to ca...
eecs445-f16/umich-eecs445-f16
lecture11_info-theory-decision-trees/collocations/Collocations Example.ipynb
mit
# read text file text_path = "data/crime-and-punishment.txt"; with open(text_path) as f: text_raw = f.read().lower(); # remove punctuation translate_table = dict((ord(char), None) for char in string.punctuation); text_raw = text_raw.translate(translate_table); # tokenize tokens = nltk.word_tokenize(text_raw); big...
CompPhysics/MachineLearning
doc/src/week43/.ipynb_checkpoints/week43-checkpoint.ipynb
cc0-1.0
%matplotlib inline # Start importing packages import pandas as pd import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.keras import datasets, layers, models from tensorflow.keras.layers import Input from tensorflow.keras.models import Model, Sequential from tensorflow.keras.layer...
tensorflow/probability
tensorflow_probability/examples/statistical_rethinking/notebooks/02_small_worlds_and_large_worlds.ipynb
apache-2.0
#@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, sof...
mxbu/logbook
blog-notebooks/arctic_crypto_database.ipynb
mit
import urllib import json import time import pandas as pd import datetime from arctic import Arctic import arctic import subprocess import platform import os import krakenex if platform.system() == "Darwin": os.chdir('/users/'+os.getlogin()+'/MEGA/App') if platform.system() == "Darwin": subprocess.Popen(['/usr/loc...
parrt/lolviz
examples.ipynb
bsd-3-clause
from lolviz import * objviz([u'2016-08-12',107.779999,108.440002,107.779999,108.18]) table = [ ['Date','Open','High','Low','Close','Volume'], ['2016-08-12',107.779999,108.440002,107.779999,108.18,18612300,108.18], ] objviz(table) d = dict([(c,chr(c)) for c in range(ord('a'),ord('f'))]) objviz(d) tuplelist =...
computational-class/cjc2016
code/0.common_questions.ipynb
mit
import graphlab as gl from IPython.display import display from IPython.display import Image gl.canvas.set_target('ipynb') """ Explanation: 在anaconda 环境中运行jupyter notebook 问题及其解决方法 Mac电脑如何快速找到用户目录 - 1、在finder的偏好设置中选择边栏选中个人收藏下房子的图标,然后在边栏就可以看到用户目录,然后就可以找到目录了。 2、在finder的偏好设置中选择通用,然后选择磁盘,磁盘就出现在桌面了,这样也可以很方便的进入根目录,进而找...
tensorflow/docs-l10n
site/ko/guide/checkpoint.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...
mdeff/ntds_2016
algorithms/06_sol_recurrent_nn.ipynb
mit
# Import libraries import tensorflow as tf import numpy as np import collections import os # Load text data data = open(os.path.join('datasets', 'text_ass_6.txt'), 'r').read() # must be simple plain text file print('Text data:',data) chars = list(set(data)) print('\nSingle characters:',chars) data_len, vocab_size = le...
elenduuche/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...
rvperry/phys202-2015-work
assignments/assignment05/InteractEx03.ipynb
mit
%matplotlib inline from matplotlib import pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.display import display """ Explanation: Interact Exercise 3 Imports End of explanation """ np.sech? def soliton(x, t, c, a): """Return phi(x, t) for a soliton wa...
jacobdein/alpine-soundscapes
Calculate elevation range.ipynb
mit
from geo.models import Raster from geo.models import Boundary import rasterio from shapely.geometry import shape import numpy import numpy.ma import rasterio.mask from matplotlib import cm as colormaps from matplotlib import pyplot %matplotlib inline """ Explanation: Calculate elevation range This notebook calculate...
InsightSoftwareConsortium/ITKExamples
src/Core/Transform/MutualInformationAffine/MutualInformationAffine.ipynb
apache-2.0
import os import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from urllib.request import urlretrieve import itk from itkwidgets import compare, checkerboard """ Explanation: Mutual Information Metric The MutualInformationImageToImageMetric class computes the mutual information between two ima...
cosmicBboy/mLearn
02. Linear Regression.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np plt.style.use('ggplot') # X is the explanatory variable data structure X = [[6], [8], [10], [14], [18]] # Y is the response variable data structure y = [[7], [9], [13], [17.5], [18]] # instantiate a pyplot figure object plt.figure() plt.title('Fi...
flsantos/startup_acquisition_forecast
dataset_preparation.ipynb
mit
#All imports here import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import preprocessing from datetime import datetime from dateutil import relativedelta %matplotlib inline #Let's start by importing our csv files into dataframes df_companies = pd.read_csv('data/companies.csv') df_acq...
sandeep-n/incubator-systemml
samples/jupyter-notebooks/Linear_Regression_Algorithms_Demo.ipynb
apache-2.0
!pip show systemml """ Explanation: Linear Regression Algorithms using Apache SystemML This notebook shows: - Install SystemML Python package and jar file - pip - SystemML 'Hello World' - Example 1: Matrix Multiplication - SystemML script to generate a random matrix, perform matrix multiplication, and compute th...
karlstroetmann/Artificial-Intelligence
Python/4 Automatic Theorem Proving/Knuth-Bendix-Algorithm-KBO.ipynb
gpl-2.0
%run Parser.ipynb !cat Examples/quasigroups.eqn || type Examples\quasigroups.eqn def test(): t = parse_term('x * y * z') print(t) print(to_str(t)) eq = parse_equation('i(x) * x = 1') print(eq) print(to_str(parse_file('Examples/quasigroups.eqn'))) test() """ Explanation: The Knuth-Bendix ...
darrenxyli/deeplearning
lessons/handwritten/handwritten-digit-recognition-with-tflearn-exercise.ipynb
apache-2.0
# Import Numpy, TensorFlow, TFLearn, and MNIST data import numpy as np import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist """ Explanation: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9. This...
mne-tools/mne-tools.github.io
0.21/_downloads/a68128275cc59b074b8c9782296d1d4a/decoding_rsa.ipynb
bsd-3-clause
# Authors: Jean-Remi King <jeanremi.king@gmail.com> # Jaakko Leppakangas <jaeilepp@student.jyu.fi> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import os.path as op import numpy as np from pandas import read_csv import matplotlib.pyplot as plt from sklearn.model_sel...
turbomanage/training-data-analyst
courses/machine_learning/deepdive2/introduction_to_tensorflow/labs/2_dataset_api.ipynb
apache-2.0
# Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.0 || pip install tensorflow==2.0 import json import math import os from pprint import pprint import numpy as np import tensorflow as tf print(tf.version.VERSION) """ Explanation: TensorFlow Dataset API Learning Objectives 1. Lear...
marcelomiky/PythonCodes
Coursera/CICCP2/Curso Introdução à Ciência da Computação com Python - Parte 2.ipynb
mit
def cria_matriz(tot_lin, tot_col, valor): matriz = [] #lista vazia for i in range(tot_lin): linha = [] for j in range(tot_col): linha.append(valor) matriz.append(linha) return matriz x = cria_matriz(2, 3, 99) x def cria_matriz(tot_lin, tot_col, valor): matriz =...
quoniammm/happy-machine-learning
Udacity-ML/boston_housing-master_1/boston_housing.ipynb
mit
# Import libraries necessary for this project # 载入此项目所需要的库 import numpy as np import pandas as pd import visuals as vs # Supplementary code from sklearn.model_selection import ShuffleSplit # Pretty display for notebooks # 让结果在notebook中显示 %matplotlib inline # Load the Boston housing dataset # 载入波士顿房屋的数据集 data = pd.rea...
dcavar/python-tutorial-for-ipython
notebooks/Python Scikit-Learn for Computational Linguists.ipynb
apache-2.0
from sklearn import datasets """ Explanation: Python Scikit-Learn for Computational Linguists (C) 2017 by Damir Cavar Version: 1.0, January 2017 License: Creative Commons Attribution-ShareAlike 4.0 International License (CA BY-SA 4.0) This tutorial was developed as part of my course material for the course Machine Lea...
mathemage/h2o-3
examples/deeplearning/notebooks/deeplearning_anomaly_detection.ipynb
apache-2.0
import h2o from h2o.estimators.deeplearning import H2OAutoEncoderEstimator h2o.init() %matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt import os.path PATH = os.path.expanduser("~/h2o-3/") train_ecg = h2o.import_file(PATH + "smalldata/anomaly/ecg_discord_train.csv") test_ecg = h...
mne-tools/mne-tools.github.io
dev/_downloads/70e603ce6ceb1fd2cb094ccee99a1920/resolution_metrics_eegmeg.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.resolution_matrix import make_inverse_resolution_matrix from mne.minimum_norm.spatial_resolution import resolution_metrics print(__doc__) data_path = sample.data_path() subject...
llclave/Springboard-Mini-Projects
Heights and Weights Using 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...
ES-DOC/esdoc-jupyterhub
notebooks/mpi-m/cmip6/models/icon-esm-lr/ocean.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mpi-m', 'icon-esm-lr', 'ocean') """ Explanation: ES-DOC CMIP6 Model Properties - Ocean MIP Era: CMIP6 Institute: MPI-M Source ID: ICON-ESM-LR Topic: Ocean Sub-Topics: Timestepping Framework, Adv...
AllenDowney/ModSimPy
soln/rabbits3soln.ipynb
mit
%matplotlib inline from modsim import * """ Explanation: Modeling and Simulation in Python Rabbit example Copyright 2017 Allen Downey License: Creative Commons Attribution 4.0 International End of explanation """ system = System(t0 = 0, t_end = 20, juvenile_pop0 = 0, ...
quantumlib/Cirq
docs/tutorials/basics.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 unde...
martinggww/lucasenlights
MachineLearning/DataScience-Python3/MatPlotLib.ipynb
cc0-1.0
%matplotlib inline from scipy.stats import norm import matplotlib.pyplot as plt import numpy as np x = np.arange(-3, 3, 0.01) plt.plot(x, norm.pdf(x)) plt.show() """ Explanation: MatPlotLib Basics Draw a line graph End of explanation """ plt.plot(x, norm.pdf(x)) plt.plot(x, norm.pdf(x, 1.0, 0.5)) plt.show() """ E...
lknelson/DH-Institute-2017
01-Intro to NLP/.ipynb_checkpoints/Intro to NLP-checkpoint.ipynb
bsd-2-clause
print("For me it has to do with the work that gets done at the crossroads of digital media and traditional humanistic study. And that happens in two different ways. On the one hand, it's bringing the tools and techniques of digital media to bear on traditional humanistic questions; on the other, it's also bringing huma...
kit-cel/lecture-examples
qc/quantization/Uniform_Quantization_Sine.ipynb
gpl-2.0
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import librosa import librosa.display import IPython.display as ipd """ Explanation: Illustration of Uniform Quantization This code is provided as supplementary material of the lecture Quellencodierung. This code illustrates * Uniform scalar quantiz...
amirziai/learning
python/Using reindex for adding missing columns to a dataframe.ipynb
mit
import pandas as pd df = pd.DataFrame([ { 'a': 1, 'b': 2, 'd': 4 } ]) df """ Explanation: Use reindex for adding missing columns to a dataframe End of explanation """ columns = ['a', 'b', 'c', 'd'] df.reindex(columns=columns, fill_value=0) """ Explanation: Using reindex to add mis...
Mynti207/cs207project
docs/demo.ipynb
mit
# you must specify the length of the time series when loading the database ts_length = 100 # when running from the terminal # python go_server_persistent.py --ts_length 100 --db_name 'demo' # here we load the server as a subprocess for demonstration purposes server = subprocess.Popen(['python', '../go_server_persiste...
rainyear/pytips
Tips/2016-03-08-Functional-Programming-in-Python.ipynb
mit
# map 函数的模拟实现 def myMap(func, iterable): for arg in iterable: yield func(arg) names = ["ana", "bob", "dogge"] print(map(lambda x: x.capitalize(), names)) # Python 2.7 中直接返回列表 for name in myMap(lambda x: x.capitalize(), names): print(name) # filter 函数的模拟实现 def myFilter(func, iterable): for arg in ...
CalPolyPat/phys202-2015-work
assignments/assignment06/InteractEx05.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.html.widgets import interact, interactive, fixed from IPython.html import widgets from IPython.display import display, SVG """ Explanation: Interact Exercise 5 Imports Put the standard imports for Matplotlib, Numpy and the IPython widge...
ethen8181/machine-learning
time_series/fft/fft.ipynb
mit
# code for loading the format for the notebook import os # path : store the current path to convert back to it later path = os.getcwd() os.chdir(os.path.join('..', '..', 'notebook_format')) from formats import load_style load_style(css_style='custom2.css', plot_style=False) os.chdir(path) # 1. magic for inline plot...
rvernagus/data-science-notebooks
Data Science From Scratch/7 - Hypothesis And Inference.ipynb
mit
def normal_approximation_to_binomial(n, p): """return mu and sigma corresponding to Binomial(n, p)""" mu = p * n sigma = math.sqrt(p * (1 - p) * n) return mu, sigma normal_probability_below = normal_cdf def normal_probability_above(lo, mu=0, sigma=1): return 1 - normal_cdf(lo, mu, sigma) def norm...
tbphu/fachkurs_bachelor
tellurium/loesungen/Roadrunner_Uebung_Loesung.ipynb
mit
Repressilator = urllib2.urlopen('http://antimony.sourceforge.net/examples/biomodels/BIOMD0000000012.txt').read() """ Explanation: Roadrunner Methoden Antimony Modell aus Modell-Datenbank abfragen: Lade mithilfe von urllib2 das Antimony-Modell des "Repressilator" herunter. Benutze dazu die urllib2 Methoden urlopen() un...
dipanjanS/text-analytics-with-python
New-Second-Edition/Ch03 - Processing and Understanding Text/Ch03c - BONUS - Text Parsing with Stanford CoreNLP.ipynb
apache-2.0
# set java path import os java_path = r'C:\Program Files\Java\jre1.8.0_192\bin\java.exe' os.environ['JAVAHOME'] = java_path from nltk.parse.stanford import StanfordParser scp = StanfordParser(path_to_jar='E:/stanford/stanford-parser-full-2015-04-20/stanford-parser.jar', path_to_models_jar='E:/sta...