repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
dmlc/mxnet
example/multi-task/multi-task-learning.ipynb
apache-2.0
import logging import random import time import matplotlib.pyplot as plt import mxnet as mx from mxnet import gluon, nd, autograd import numpy as np """ Explanation: Multi-Task Learning Example This is a simple example to show how to use mxnet for multi-task learning. The network is jointly going to learn whether a n...
crystalzhaizhai/cs207_yi_zhai
lectures/L3/L3-Part2.ipynb
mit
%%bash cd /tmp rm -rf playground #remove if it exists git clone https://github.com/dsondak/playground.git %%bash cd /tmp/playground git branch -avv """ Explanation: Lecture 3: Branches with Git In Lecture 2, you worked with the playground repository. You learned how to navigate the repository from the Git point of v...
ForestClaw/forestclaw
applications/clawpack/advection/2d/periodic/periodic.ipynb
bsd-2-clause
%%bash periodic """ Explanation: Periodic <hr style="border-width:4px; border-color:coral"> </hr> Scalar advection problem of a disk in a periodic domain Serial mode <hr style="border-width:2px; border-color:coral"> </hr> Run code in serial mode (will work, even if code is compiled with MPI) End of explanation """ ...
google/learned_optimization
docs/notebooks/Part4_GradientEstimators.ipynb
apache-2.0
import numpy as np import jax.numpy as jnp import jax import functools from matplotlib import pylab as plt from typing import Optional, Tuple, Mapping from learned_optimization.outer_trainers import full_es from learned_optimization.outer_trainers import truncated_pes from learned_optimization.outer_trainers import tr...
obust/Pandas-Tutorial
Pandas II - Working with DataFrames.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt pd.set_option('max_columns', 50) """ Explanation: Pandas II - Working with DataFrames End of explanation """ # pass in column names for each CSV u_cols = ['user_id', 'age', 'sex', 'occupation', 'zip_code'] df_users = pd.read_csv('data/MovieLens-...
Davidwwww/intro-numerical-methods
5_root_finding_optimization.ipynb
mit
def total_value(P, m, r, n): """Total value of portfolio given parameters Based on following formula: A = \frac{P}{(r / m)} \left[ \left(1 + \frac{r}{m} \right)^{m \cdot n} - 1 \right ] :Input: - *P* (float) - Payment amount per compounding period - *m* (int) - ...
nilbody/h2o-3
h2o-py/demos/turbofan_phm_gtkerror_NOPASS.ipynb
apache-2.0
import sys import h2o from h2o.estimators.glm import H2OGeneralizedLinearEstimator from h2o.estimators.gbm import H2OGradientBoostingEstimator from h2o.utils.shared_utils import _locate import numpy as np import pandas as pd import seaborn as sns import pykalman as pyk sns.set() doGridSearch = True doKalmanSmoothing...
KrisCheng/ML-Learning
archive/MOOC/Deeplearning_AI/ImprovingDeepNeuralNetworks/OptimizationMethods/Optimization+methods.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import scipy.io import math import sklearn import sklearn.datasets from opt_utils import load_params_and_grads, initialize_parameters, forward_propagation, backward_propagation from opt_utils import compute_cost, predict, predict_dec, plot_decision_boundary, load_data...
pycomlink/pycomlink
notebooks/outdated_notebooks/Baseline determination.ipynb
bsd-3-clause
cml = pycml.io.examples.read_one_cml() # Remove artifacts and plot data cml.process.quality_control.set_to_nan_if('tx', '>=', 100) cml.process.quality_control.set_to_nan_if('rx', '==', -99.9) cml.plot_data(['tx', 'rx', 'txrx']); """ Explanation: Read in example data from one CML End of explanation """ cml.process....
Danghor/Formal-Languages
ANTLR4-Python/SLR-Parser-Generator/Shift-Reduce-Parser-Pure.ipynb
gpl-2.0
import re """ Explanation: A Shift-Reduce Parser for Arithmetic Expressions In this notebook we implement a simple recursive descend parser for arithmetic expressions. This parser will implement the following grammar: $$ \begin{eqnarray} \mathrm{expr} & \rightarrow & \mathrm{expr}\;\;\texttt{'+'}\;\;\mathrm...
DylanM-Marshall/FIDDLE
fiddle/predictions_visualization.ipynb
gpl-3.0
%matplotlib inline from matplotlib import pylab as pl from scipy import stats import numpy as np import pandas as pd import h5py from matplotlib.backends.backend_pdf import PdfPages """ Explanation: FIDDLE Predictions Visualization Tutorial: This notebook outlines how to create graphs from the data in the output files...
poldrack/fmri-analysis-vm
analysis/RTmodeling/RTmodeling.ipynb
mit
import numpy as np import pandas as pd import nibabel from nipy.modalities.fmri.hemodynamic_models import spm_hrf import matplotlib.pyplot as plt import nipype.algorithms.modelgen as model # model generation from nipype.interfaces.base import Bunch from nipype.interfaces import fsl from statsmodels.tsa.arima_process ...
hungiyang/StatisticalMethods
examples/SDSScatalog/GalaxySizes.ipynb
gpl-2.0
%load_ext autoreload %autoreload 2 from __future__ import print_function import numpy as np import SDSS import pandas as pd import matplotlib %matplotlib inline galaxies = "SELECT top 1000 \ petroR50_i AS size, \ petroR50Err_i AS err \ FROM PhotoObjAll \ WHERE \ (type = '3' AND petroR50Err_i > 0)" print (galaxies) #...
muxuezi/jupyterworkflow
101basic/001_Pandas_vs_SQL.ipynb
mit
import pandas as pd import numpy as np url = 'https://raw.github.com/pandas-dev/pandas/master/pandas/tests/data/tips.csv' tips = pd.read_csv(url) tips.head() """ Explanation: Why is Python Growing So Quickly? <center><img width=512 src=https://zgab33vy595fw5zq-zippykid.netdna-ssl.com/wp-content/uploads/2017/09/relate...
liganega/Gongsu-DataSci
previous/notes2017/W03/GongSu06_Errors_and_Exception_Handling.ipynb
gpl-3.0
from __future__ import print_function input_number = raw_input("A number please: ") number = int(input_number) print("제곱의 결과는", number**2, "입니다.") """ Explanation: 오류 및 예외 처리 개요 코딩할 때 발생할 수 있는 다양한 오류 살펴 보기 오류 메시지 정보 확인 방법 예외 처리, 즉 오류가 발생할 수 있는 예외적인 상황을 미리 고려하는 방법 소개 오늘의 주요 예제 아래 코드는 raw_input() 함수를 이용하여 사용자로...
ireapps/cfj-2017
completed/02. Working with data files.ipynb
mit
import csv """ Explanation: Working with data files Reading and writing data files is a common task, and Python offers native support for working with many kinds of data files. Today, we're going to be working mainly with CSVs. Import the csv module We're going to be working with delimited text files, so the first thi...
jamiebull1/eppy
docs/runningeplus.ipynb
mit
# you would normaly install eppy by doing # python setup.py install # or # pip install eppy # or # easy_install eppy # if you have not done so, uncomment the following three lines import sys # pathnameto_eppy = 'c:/eppy' pathnameto_eppy = '../' sys.path.append(pathnameto_eppy) from eppy.modeleditor import IDF iddfil...
mne-tools/mne-tools.github.io
stable/_downloads/88563c785f9a977b7ce2000e660aeacf/30_annotate_raw.ipynb
bsd-3-clause
import os from datetime import timedelta 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, verbose=False) raw.crop(tmax=60)...
kubeflow/katib
examples/v1beta1/sdk/nas-with-darts.ipynb
apache-2.0
# Install required package (Katib SDK). !pip install kubeflow-katib==0.13.0 """ Explanation: Neural Architecture Search with DARTS In this example you will deploy Katib Experiment with Differentiable Architecture Search (DARTS) algorithm using Jupyter Notebook and Katib SDK. Your Kubernetes cluster must have at least ...
zakandrewking/cobrapy
documentation_builder/io.ipynb
lgpl-2.1
import cobra.test import os from os.path import join data_dir = cobra.test.data_dir print("mini test files: ") print(", ".join(i for i in os.listdir(data_dir) if i.startswith("mini"))) textbook_model = cobra.test.create_test_model("textbook") ecoli_model = cobra.test.create_test_model("ecoli") salmonella_model = cob...
XInterns/IPL-Sparkers
src/Match Outcome Prediction with IPL Data (Gursahej).ipynb
mit
# The %... is an iPython thing, and is not part of the Python language. # In this case we're just telling the plotting library to draw things on # the notebook, instead of on a separate window. %matplotlib inline #this line above prepares IPython notebook for working with matplotlib # See all the "as ..." contructs? ...
ini-python-course/ss15
notebooks/PCA and Eigenfaces.ipynb
mit
# prepare some imports import numpy as np from sklearn.datasets import fetch_mldata import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Principal Component Analysis & Eigenfaces Here we are going to introduce and implement Principal Component Analysis (PCA) which is a very common and important algorith...
mimoralea/applied-reinforcement-learning
notebooks/05-state-discretization.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt import tempfile import base64 import pprint import json import sys import gym import io from gym import wrappers from subprocess import check_output from IPython.display import HTML """ Explanation: State Space Discretization From the previous no...
ES-DOC/esdoc-jupyterhub
notebooks/test-institute-3/cmip6/models/sandbox-1/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-1', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: TEST-INSTITUTE-3 Source ID: SANDBOX-1 Topic: Atmos Sub-Topics: Dynamical...
tensorflow/examples
courses/udacity_intro_to_tensorflow_for_deep_learning/l08c07_forecasting_with_stateful_rnn.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...
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/tf2_semantic_approximate_nearest_neighbors.ipynb
apache-2.0
# Copyright 2018 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...
DistrictDataLabs/yellowbrick
examples/jkeung/testing.ipynb
apache-2.0
import numpy as np import matplotlib.pyplot as plt from sklearn import svm, datasets from sklearn.metrics import roc_curve, auc from sklearn.model_selection import train_test_split """ Explanation: ROC Curve Example Inspired by: http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html This is an exa...
Merinorus/adaisawesome
Homework/04 - Applied ML/Homework_04_Referees_teamawesome-Q1 + Bonus.ipynb
gpl-3.0
import pandas as pd import numpy as np import matplotlib.pyplot as plt # Import the random forest package from sklearn.ensemble import RandomForestClassifier filename ="CrowdstormingDataJuly1st.csv" Data = pd.read_csv(filename) """ Explanation: I. Setting up the Problem End of explanation """ Data.ix[:10,:13] D...
antongrin/EasyMig
EasyMig_v4-interact3.ipynb
apache-2.0
# -*- coding: utf-8 -*- """ Created on Fri Feb 12 13:21:45 2016 @author: GrinevskiyAS """ from __future__ import division import numpy as np from numpy import sin,cos,tan,pi,sqrt import matplotlib as mpl import matplotlib.cm as cm import matplotlib.pyplot as plt from ipywidgets import interact, interactive, fixed im...
WNoxchi/Kaukasos
FAI_old/lesson1/dogs_cats_redux.ipynb
mit
#Verify we are in the lesson1 directory %pwd #Create references to important directories we will use over and over import os, sys current_dir = os.getcwd() LESSON_HOME_DIR = current_dir # DATA_HOME_DIR = current_dir+'/data/redux' DATA_HOME_DIR = current_dir+'/data' #Allow relative imports to directories above lesson1...
ghvn7777/ghvn7777.github.io
content/fluent_python/21_metaclass.ipynb
apache-2.0
class Dog: def __init__(self, name, weight, owner): self.name = name self.weight = weight self.owner = owner rex = Dog('Rex', 30, 'Bob') rex """ Explanation: 类元编程是指在运行时创建或定制类的技艺,在 Python 中,类是一等对象,因此任何时候都可以使用函数新建类,无需使用 class 关键字。类装饰器也是函数,不公审查,修改甚至可以把被装饰类替换成其它类。最后,元类是类元编程最高级的工具,使用元类...
gtrichards/QuasarSelection
SpIESHighzQuasars2.ipynb
mit
%matplotlib inline from astropy.table import Table import numpy as np import matplotlib.pyplot as plt data = Table.read('GTR-ADM-QSO-ir-testhighz_findbw_lup_2016_starclean.fits') # X is in the format need for all of the sklearn tools, it just has the colors # X = np.vstack([ data['ug'], data['gr'], data['ri'], data['i...
analysiscenter/dataset
examples/experiments/weights_distributions/weights_distributions.ipynb
apache-2.0
import sys sys.path.append('../../utils') import pickle import numpy as np import seaborn as sns import matplotlib.pyplot as plt from utils import plot_weights """ Explanation: Distributions of weights in ResNet34 and ResNet50 In this notebook we will compare the distribution of weights from two almost identical arc...
sbu-python-summer/python-tutorial
day-5/scipy-exercises.ipynb
bsd-3-clause
def hilbert(n): """ return a Hilbert matrix, H_ij = (i + j - 1)^{-1} """ H = np.zeros((n,n), dtype=np.float64) for i in range(1, n+1): for j in range(1, n+1): H[i-1,j-1] = 1.0/(i + j - 1.0) return H """ Explanation: Q1: integrating a sampled vs. analytic function Numerical integra...
erikdrysdale/erikdrysdale.github.io
_rmd/extra_power/winners_curse.ipynb
mit
# modules used in the rest of the post from scipy.stats import norm, truncnorm import numpy as np from numpy.random import randn from scipy.optimize import minimize_scalar import plotnine from plotnine import * import pandas as pd """ Explanation: A winner's curse adjustment for a single test statistic Background The ...
machinelearningnanodegree/stanford-cs231
solutions/levin/assignment1/two_layer_net.ipynb
mit
# A bit of setup import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.neural_net import TwoLayerNet %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 8.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['image.cmap'] = 'gray' # for auto-reloadi...
joshnsolomon/phys202-2015-work
assignments/assignment09/IntegrationEx02.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import seaborn as sns from scipy import integrate """ Explanation: Integration Exercise 2 Imports End of explanation """ def integrand(x, a): return 1.0/(x**2 + a**2) def integral_approx(a): # Use the args keyword argument to feed extra a...
mne-tools/mne-tools.github.io
0.24/_downloads/0a1bad60270bfbdeeea274fcca0015d2/multidict_reweighted_tfmxne.ipynb
bsd-3-clause
# Author: Mathurin Massias <mathurin.massias@gmail.com> # Yousra Bekhti <yousra.bekhti@gmail.com> # Daniel Strohmeier <daniel.strohmeier@tu-ilmenau.de> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD-3-Clause import os.path as op import mne from mne.datasets import somato f...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/introduction_to_tensorflow/solutions/what_if_mortgage.ipynb
apache-2.0
import sys python_version = sys.version_info[0] print("Python Version: ", python_version) !pip3 install witwidget import pandas as pd import numpy as np import witwidget from witwidget.notebook.visualization import WitWidget, WitConfigBuilder """ Explanation: LABXX: What-if Tool: Model Interpretability Using Mortga...
tpin3694/tpin3694.github.io
regex/match_any_character.ipynb
mit
# Load regex package import re """ Explanation: Title: Match Any Character Slug: match_any_character Summary: Match Any Character Date: 2016-05-01 12:00 Category: Regex Tags: Basics Authors: Chris Albon Based on: Regular Expressions Cookbook Preliminaries End of explanation """ # Create a variable containing a tex...
GoogleCloudPlatform/asl-ml-immersion
notebooks/introduction_to_tensorflow/solutions/3_keras_sequential_api_vertex.ipynb
apache-2.0
import datetime import os import shutil import numpy as np import pandas as pd import tensorflow as tf from google.cloud import aiplatform from matplotlib import pyplot as plt from tensorflow import keras from tensorflow.keras.callbacks import TensorBoard from tensorflow.keras.layers import Dense, DenseFeatures from t...
mbbrodie/fmri_reconstruction
tools/miyawaki_eigenbrain.ipynb
mit
# Some basic imports import time import sys import eigenbrain """ Explanation: Reconstruction of visual stimuli from Miyawaki et al. 2008 This example reproduces the experiment presented in Visual image reconstruction from human brain activity using a combination of multiscale local image decoders &lt;http...
datascience-practice/data-quest
python_introduction/beginner/.ipynb_checkpoints/Dictionaries-checkpoint.ipynb
mit
# Let's parse the data from the last mission as an example. # First, we open the wait times file from the last mission. f = open("crime_rates.csv", 'r') data = f.read() rows = data.split('\n') full_data = [] for row in rows: split_row = row.split(",") full_data.append(split_row) weather_data = [] f = open("la_...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/explainable_ai/sdk_automl_tabular_binary_classification_batch_explain.ipynb
apache-2.0
import os # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex SDK: AutoML training tabular binary classification model for batch explanation <table al...
tpin3694/tpin3694.github.io
machine-learning/random_forest_classifier_example.ipynb
mit
# Load the library with the iris dataset from sklearn.datasets import load_iris # Load scikit's random forest classifier library from sklearn.ensemble import RandomForestClassifier # Load pandas import pandas as pd # Load numpy import numpy as np # Set random seed np.random.seed(0) """ Explanation: Title: Random F...
xpharry/Udacity-DLFoudation
tutorials/sentiment_network/Sentiment Classification - Mini Project 4.ipynb
mit
def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].upper(),g.readlines())) g.close()...
zakandrewking/cobrapy
documentation_builder/building_model.ipynb
lgpl-2.1
from __future__ import print_function from cobra import Model, Reaction, Metabolite # Best practise: SBML compliant IDs model = Model('example_model') reaction = Reaction('3OAS140') reaction.name = '3 oxoacyl acyl carrier protein synthase n C140 ' reaction.subsystem = 'Cell Envelope Biosynthesis' reaction.lower_bound...
kowey/attelo
doc/tut_parser2.ipynb
gpl-3.0
from __future__ import print_function from os import path as fp from attelo.io import (load_multipack) CORPUS_DIR = 'example-corpus' PREFIX = fp.join(CORPUS_DIR, 'tiny') # load the data into a multipack mpack = load_multipack(PREFIX + '.edus', PREFIX + '.pairings', PREFI...
shumway/srt_bootcamp
SymPyExample.ipynb
mit
import sympy as sp sp.init_printing() """ Explanation: SymPy The SymPy package is useful for symbolic algebra, much like the commercial software Mathematica. We won't make much use of SymPy during the boot camp, but it is definitely useful to know about for mathematics courses. End of explanation """ x, y = sp.symbo...
tritemio/multispot_paper
usALEX - Corrections - Leakage fit.ipynb
mit
#bsearch_ph_sel = 'all-ph' #bsearch_ph_sel = 'Dex' bsearch_ph_sel = 'DexDem' data_file = 'results/usALEX-5samples-PR-raw-%s.csv' % bsearch_ph_sel """ Explanation: Leakage coefficient fit This notebook estracts the leakage coefficient from the set of 5 us-ALEX smFRET measurements. What it does? For each measurement,...
atulsingh0/MachineLearning
MasteringML_wSkLearn/07_Dimensionality_Reduction_with_PCA.ipynb
gpl-3.0
# import import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.datasets import load_iris %matplotlib inline X = [[2, 0, -1.4], [2.2, 0.2, -1.5], [2.4, 0.1, -1], [1.9, 0, -1.2]] print(np.array(X)) print(np.array(X).T) print(np.cov(np.array(X).T)) print(np.cov(np...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/how_google_does_ml/bigquery/solution/analyze_with_bigquery_solution.ipynb
apache-2.0
import os import pandas as pd PROJECT = "<YOUR PROJECT>" #TODO Replace with your project id os.environ["PROJECT"] = PROJECT pd.options.display.max_columns = 50 """ Explanation: Analyze a large dataset with Google BigQuery Learning Objectives Access an ecommerce dataset Look at the dataset metadata Remove duplicat...
phoebe-project/phoebe2-docs
2.2/tutorials/passband_updates.ipynb
gpl-3.0
!pip install -I "phoebe>=2.2,<2.3" """ Explanation: Advanced: passband versioning & updates 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 """ import...
ES-DOC/esdoc-jupyterhub
notebooks/nasa-giss/cmip6/models/sandbox-1/atmos.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-1', 'atmos') """ Explanation: ES-DOC CMIP6 Model Properties - Atmos MIP Era: CMIP6 Institute: NASA-GISS Source ID: SANDBOX-1 Topic: Atmos Sub-Topics: Dynamical Core, Radiati...
ES-DOC/esdoc-jupyterhub
notebooks/bcc/cmip6/models/sandbox-2/toplevel.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-2', 'toplevel') """ Explanation: ES-DOC CMIP6 Model Properties - Toplevel MIP Era: CMIP6 Institute: BCC Source ID: SANDBOX-2 Sub-Topics: Radiative Forcings. Properties: 85 (42 re...
deflaux/linkage-disequilibrium
datalab/Exploring_Linkage_Disequilibrium_Data.ipynb
apache-2.0
import gcp.bigquery as bq import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # Get references to the BigQuery tables of linkage disequilibrium # in the five superpopulations of the 1000 Genomes Project # (http://www.1000genomes.org/faq/which-populations-are-part-your-study): # AMR: Admixed Ameri...
qingshuimonk/STA663
docs/VAE_synthetic_Siyang.ipynb
mit
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import time from tensorflow.python.client import timeline import matplotlib.pyplot as plt %matplotlib inline FLAGS = tf.app.flags.FLAGS # number of device count tf.app...
Santana9937/Classification_ML_Specialization
Week_3_Decision_Trees/week_3_assign_1_safe_loans_decision_trees.ipynb
mit
import json import numpy as np import pandas as pd import sklearn, sklearn.tree import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns sns.set_style('darkgrid') %matplotlib inline """ Explanation: Identifying safe loans with decision trees The LendingClub is a peer-to-peer leading company that ...
maxrose61/GA_DS
maxrose_hw/oct13/06_yelp_votes_homework.ipynb
gpl-3.0
# access yelp.csv using a relative path import pandas as pd yelp = pd.read_csv('../data/yelp.csv') yelp.head(1) """ Explanation: Linear regression homework with Yelp votes Introduction This assignment uses a small subset of the data from Kaggle's Yelp Business Rating Prediction competition. Description of the data: y...
dkirkby/astroml-study
Chapter1/Chapter1.ipynb
mit
%pylab inline import astroML print astroML.__version__ """ Explanation: Chapter 1 Prepared by David Kirkby &#100;&#107;&#105;&#114;&#107;&#98;&#121;&#64;&#117;&#99;&#105;&#46;&#101;&#100;&#117; on 14-Jan-2016. End of explanation """ """ SDSS Spectrum Example --------------------- Figure 1.2. An example of an SDSS ...
bmeaut/python_nlp_2017_fall
course_material/04_Object_oriented_programming/04_Object_oriented_programming_lecture.ipynb
mit
class ClassWithInit: def __init__(self): pass class ClassWithoutInit: pass """ Explanation: Introduction to Python and Natural Language Technologies Lecture 03, Week 04 Object oriented programming 27 September 2017 Introduction Python has been object oriented since its first version basically eve...
BelalC/keyword_i2x
notebooks/sketch.ipynb
mit
from sklearn.feature_extraction import stop_words from nltk.corpus import stopwords import math from textblob import TextBlob as tb with open("scripts/script.txt", "r") as f: data = f.read() #with open("scripts/script.txt", "r") as f: # data2 = f.readlines() #for line in data: # words = data.split() with...
quasars100/Resonance_testing_scripts
python_tutorials/Megno.ipynb
gpl-3.0
def simulation(par): a, e = par # unpack parameters rebound.reset() rebound.integrator = "whfast-nocor" rebound.dt = 5. rebound.add(m=1.) # Star rebound.add(m=0.000954, a=5.204, anom=0.600, omega=0.257, e=0.048) rebound.add(m=0.000285, a=a, anom=0.871, omega=1.616, e=e) rebound.move_to_...
nathanshammah/pim
doc/notebooks/piqs_steadystate_superradiance.ipynb
mit
import matplotlib.pyplot as plt from qutip import * from piqs import * """ Explanation: Steady-state superradiance We consider a system of $N$ two-level systems (TLSs) with identical frequency $\omega_{0}$, incoherently pumped at a rate $\gamma_\text{P}$ and de-excitating at a collective emission rate $\gamma_\text{CE...
DaveBackus/Data_Bootcamp
Code/SQL/SQL_Bootcamp_Stern_2016.ipynb
mit
from IPython.display import display, HTML, clear_output HTML('''<script> code_show=true; function code_toggle() {if (code_show){$('div.input').hide();} else {$('div.input').show();}code_show = !code_show} $( document ).ready(code_toggle); </script> <form action="javascript:code_toggle()"><input type="submit" value="Hi...
tgsmith61591/pyramid
examples/quick_start_example.ipynb
mit
import numpy as np import pmdarima as pm print('numpy version: %r' % np.__version__) print('pmdarima version: %r' % pm.__version__) """ Explanation: auto_arima Pmdarima bring R's auto.arima functionality to Python by wrapping statsmodel ARIMA and SARIMAX models into a singular scikit-learn-esque estimator (pmdarima.a...
aflaxman/siaman16-va-minitutorial
2-tutorial-notebook-solutions/4-va_csmf.ipynb
gpl-3.0
import numpy as np, pandas as pd """ Explanation: We won't work through this notebook We won't have time. But I thought I'd include it, in case you want to see exactly how I implement my population-level quality metric. End of explanation """ def measure_prediction_quality(csmf_pred, y_test): """Calculate popul...
ES-DOC/esdoc-jupyterhub
notebooks/messy-consortium/cmip6/models/emac-2-53-aerchem/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'messy-consortium', 'emac-2-53-aerchem', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: MESSY-CONSORTIUM Source ID: EMAC-2-53-AERCHEM Topic: Land Sub-Topi...
rjurney/Agile_Data_Code_2
ch09/Improving_Predictions.ipynb
mit
import sys, os, re import json import datetime, iso8601 from tabulate import tabulate # Initialize PySpark APP_NAME = "Improving Predictions" # If there is no SparkSession, create the environment try: sc and spark except NameError as e: import findspark findspark.init() import pyspark import pyspa...
google/learned_optimization
docs/notebooks/no_dependency_learned_optimizer.ipynb
apache-2.0
import jax import jax.numpy as jnp import tensorflow_datasets as tfds import matplotlib.pylab as plt import numpy as onp import functools import os """ Explanation: No dependency introduction to learned optimizers in JAX This notebook contains a self contained implementation of learned optimizers in JAX. It is minimal...
ernestyalumni/cuBlackDream
examples/RModule.ipynb
mit
import numpy import numpy as np m=6 n=4 k=5 """ Explanation: $R$-Module Doing $R$-module (equipped with Hadamard operators) algebraic operations; addition, multiplication, and element-wise Hadamard operations Certainly, we'd want to ensure, or at least evince, through examples that we can do the same algebraic opera...
mne-tools/mne-tools.github.io
0.21/_downloads/bc5044f9d3ef1d29067dd6b7d83ceed2/plot_20_visualize_epochs.ipynb
bsd-3-clause
import os 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, verbose=False).crop(tmax=120) """ Explanation: Visualizing epo...
agile-geoscience/notebooks
To_build_a_better_wedge.ipynb
apache-2.0
import numpy as np % matplotlib inline import matplotlib.pyplot as plt """ Explanation: To make a better wedge This notebook is an update to the notebook entitled "To make a wedge" featured in the blog post, To make a wedge, on December 12, 2013. Start by importing Numpy and Matplotlib's pyplot module in the usual way...
Caranarq/01_Dmine
Datasets/Pigoo/.ipynb_checkpoints/pigoo_desagregacion-checkpoint.ipynb
gpl-3.0
# Librerias utilizadas import pandas as pd import sys module_path = r'D:\PCCS\01_Dmine\Scripts' if module_path not in sys.path: sys.path.append(module_path) from SUN.asignar_sun import asignar_sun from SUN_integridad.SUN_integridad import SUN_integridad from SUN.CargaSunPrincipal import getsun # Configuracion del ...
Astrohackers-TW/IANCUPythonAdventure
notebooks/notebooks4HowtoSeries/how_to_cross-match_two_tables.ipynb
mit
table_a = pd.read_csv('files/table_A.csv') table_b = pd.read_csv('files/table_B.csv') table_a.head() table_b.head() print('Table A 有', len(table_a), '個樣本') print('Table B 有', len(table_b), '個樣本') ra_a = table_a['ra'] dec_a = table_a['dec'] ra_b = table_b['wise_ra'] dec_b = table_b['wise_dec'] """ Explanation: 載入 ...
adolfoguimaraes/machinelearning
Tensorflow/Tutorial02_MLP.ipynb
mit
import numpy as np import matplotlib.pyplot as plt def soma(x, y): return x + y #Criando os dados de entrada (x = features e y = classes) x_train = np.array([[2., 2.],[1., 3.],[2., 3.],[5., 3.],[7., 3.],[2., 4.],[3., 4.],[6., 4.], [1., 5.],[2., .5],[5., 5.],[4., 6.],[6., 6.],[5., 7.]],dtype="...
mne-tools/mne-tools.github.io
0.23/_downloads/775a4c9edcb81275d5a07fdad54343dc/channel_epochs_image.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ Explanation: Visualize channel over epochs as an image This will...
Upward-Spiral-Science/uhhh
code/Graph Analysis/Delaunay.ipynb
apache-2.0
import csv from scipy.stats import kurtosis from scipy.stats import skew from scipy.spatial import Delaunay import numpy as np import math import skimage import matplotlib.pyplot as plt import seaborn as sns from skimage import future import networkx as nx from ragGen import * %matplotlib inline sns.set_color_codes("pa...
rdhyee/diversity-census-calc
03_01_Geographical_Hierarchies.ipynb
apache-2.0
# YouTube video I made on how to use the American Factfinder site to look up addresses from IPython.display import YouTubeVideo YouTubeVideo('HeXcliUx96Y') # standard numpy, pandas, matplotlib imports import numpy as np import matplotlib.pyplot as plt from pandas import DataFrame, Series, Index import pandas as pd ...
bollwyvl/dangerous-playgrounds
index.ipynb
bsd-3-clause
import traitlets import ipywidgets as widgets import types """ Explanation: Building Dangerous Live-Coding Playgrounds with Jupyter Widgets Motivation Playground applications, where each user keystroke in any number of source documents updates an output document, allow you to fail fast, and are a great way to learn n...
xR86/ml-stuff
kaggle/zmisc/Book Recommendations from Charles Darwin/notebook_bad.ipynb
mit
# Import library import glob # The books files are contained in this folder folder = "datasets/" # List all the .txt files and sort them alphabetically files = glob.glob(folder + '*.txt') # ... YOUR CODE FOR TASK 1 ... files.sort() """ Explanation: 1. Darwin's bibliography <p><img src="https://assets.datacamp.com/pr...
atulsingh0/MachineLearning
HandsOnML/code/16_reinforcement_learning.ipynb
gpl-3.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 import sys # 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(...
amueller/scipy-2017-sklearn
notebooks/19.Feature_Selection.ipynb
cc0-1.0
from sklearn.datasets import load_breast_cancer, load_digits from sklearn.model_selection import train_test_split cancer = load_breast_cancer() # get deterministic random numbers rng = np.random.RandomState(42) noise = rng.normal(size=(len(cancer.data), 50)) # add noise features to the data # the first 30 features ar...
david4096/bioapi-examples
python_notebooks/regionSearch.ipynb
apache-2.0
from ga4gh.client import client c = client.HttpClient("http://1kgenomes.ga4gh.org") import sys import collections import math %matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt from ipywidgets import interact, interactive, fixed from IPython.display import display import ipywidget...
hmenke/pairinteraction
doc/sphinx/examples_python/comparison_to_saffman_fig13.ipynb
gpl-3.0
%matplotlib inline # Arrays import numpy as np # Plotting import matplotlib.pyplot as plt # Operating system interfaces import os, sys # Parallel computing if sys.platform != "win32": from multiprocessing import Pool from functools import partial # pairinteraction :-) from pairinteraction import pireal as pi # Cr...
MegaShow/college-programming
Homework/Principles of Artificial Neural Networks/Week 3 Backpropagation/week_3_numpy.ipynb
mit
# set some inputs x1 = -2; x2 = 5; # perform the forward pass f = x1 * x2 # f becomes -10 # perform the backward pass (backpropagation) in reverse order: # backprop through f = x * y dfdx1 = x2 # df/dx = y, so gradient on x becomes 5 print("gradient on x is {:2}".format(dfdx1)) dfdx2 = x1 # df/dy = x, so gradient on ...
skkandrach/foundations-homework
Homework 11 Soma.ipynb
mit
plate_info = {'Plate ID': 'str'} df = pd.read_csv("small-violations.csv", dtype=plate_info) df df.head() df.head(10) df.tail() """ Explanation: 1. I want to make sure my Plate ID is a string. Can't lose the leading zeroes! End of explanation """ plate_info = {'Plate ID': 'str'} df = pd.read_csv("small-violations...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session05/Day4/stackdiff_Narayan/02_Reprojection/Reproject_images_exercise.ipynb
mit
import numpy as np import matplotlib import astropy.io.fits as afits from astropy.wcs import WCS import reproject from astropy.visualization import ZScaleInterval import astropy.table as at import astropy.coordinates as coords import astropy.units as u from astropy.visualization.wcsaxes import WCSAxes import astropy.vi...
asazo/ANN
tarea3/Pregunta 2.ipynb
mit
import numpy as np from theano.tensor.shared_randomstreams import RandomStreams from matplotlib import pyplot from keras.preprocessing import sequence from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.layers.embeddings import Embedding from keras.layers import D...
Oli4/lsi-material
Algorithmic_Basics_of_Bioinformatics/Algorithmic Basics of Bioinformatics Tutorial Sheet 6.ipynb
mit
def DPChange(M,c,d): import math best_num_coins = [0] for m in range(1,M+1): best_num_coins.append(math.inf) for i in range(0,d): if m >= c[i]: if best_num_coins[m-c[i]] +1 < best_num_coins[m]: best_num_coins[m] = best_num_coins[m-c[i]] + 1 ...
nonotone79/investigativ
02 Jupyter Notebook & Python Intro.ipynb
mit
#Mit einem Hashtag vor einer Zeile können wir Code kommentieren, auch das ist sehr wichtig. #Immer, wirklich, immer den eigenen Code zu kommentieren. Vor allem am Anfang. print('hello world') #Der Printbefehl druckt einfach alles aus. Nicht wirklich wahnsinnig toll. #Doch er ist später sehr nützlich. Vorallem wenn ...
datascienceguide/datascienceguide.github.io
tutorials/Exploratory-Data-Analysis-Tutorial.ipynb
mit
import matplotlib.pyplot as plt import numpy as np import pandas as pd %matplotlib inline anscombe_i = pd.read_csv('../datasets/anscombe_i.csv') anscombe_ii = pd.read_csv('../datasets/anscombe_ii.csv') anscombe_iii = pd.read_csv('../datasets/anscombe_iii.csv') anscombe_iv = pd.read_csv('../datasets/anscombe_iv.csv') ...
google/starthinker
colabs/anonymize_query.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: BigQuery Anonymize Query Runs a query and anynonamizes all rows. Used to create sample table for dashboards. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in c...
ericmjl/Network-Analysis-Made-Simple
archive/8-US-airports-case-study-student.ipynb
mit
%matplotlib inline import networkx as nx import pandas as pd import matplotlib.pyplot as plt import numpy as np import warnings warnings.filterwarnings('ignore') pass_air_data = pd.read_csv('datasets/passengers.csv') """ Explanation: Exploratory analysis of the US Airport Dataset This dataset contains data for 25 yea...
hektor-monteiro/curso-python
erros-velocidade.ipynb
gpl-2.0
x = 1.e308 y = x * 10. print x,y """ Explanation: Acurácia e velocidade Agora já temos os componentes básicos da linguagem Python para poder atacar os problemas de física no entanto, precisamos explorar ainda as limitações do computador visto que não pode guardar números com precisão infinita existe um limite superior...
cuemacro/chartpy
chartpy_examples/notebooks/web_page_examples.ipynb
apache-2.0
import sys try: sys.path.append('E:/Remote/chartpy') except: pass """ Explanation: Creating charts (& webpages!) with chartpy By Saeed Amen (@saeedamenfx) - saeed@cuemacro.com A great way to present a group of charts is via a webpage. How can we do this in a quick and easy way in Python? Furthemore, how can w...
yashdeeph709/Algorithms
PythonBootCamp/Complete-Python-Bootcamp-master/.ipynb_checkpoints/While loops -checkpoint.ipynb
apache-2.0
x = 0 while x < 10: print 'x is currently: ',x print ' x is still less than 10, adding 1 to x' x+=1 """ Explanation: while loops The while statement in Python is one of most general ways to perform iteration. A while statement will repeatedly execute a single statement or group of statements as long as th...
AntArch/Presentations_Github
20150916_OGC_Reuse_under_licence/.ipynb_checkpoints/20150916_OGC_Reuse_under_licence-checkpoint_conflict-20150910-195436.ipynb
cc0-1.0
from IPython.display import YouTubeVideo YouTubeVideo('F4rFuIb1Ie4') ## PDF output using pandoc import os ### Export this notebook as markdown commandLineSyntax = 'ipython nbconvert --to markdown 20150916_OGC_Reuse_under_licence.ipynb' print (commandLineSyntax) os.system(commandLineSyntax) ### Export this noteboo...
harish-garg/Machine-Learning
udacity/enron/ud120-projects-master/final_project/Data Exploration and Cleanup.ipynb
mit
print "print out some values of the observation 'TOTAL'" for name, person in data_dict.iteritems(): if name == 'TOTAL': print person salary = [] for name, person in data_dict.iteritems(): if float(person['salary']) > 0: salary.append(float(person['salary'])) print "the sum of salary of all other person...
BL-Labs/poetryhunt
WordFrequencyClassifier.ipynb
mit
from newspaperaccess import * # Get the connection set up to get access to the newspaper text n = NewspaperArchive() # Load up the references to the pages that we know reference Abolitionists import csv # Month list to convert a name to a number: MONTHS = {"january": "01", "february": "02", "march": "03", "april": "...