repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
phoebe-project/phoebe2-docs
2.1/tutorials/general_concepts.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: General Concepts HOW TO RUN THIS FILE: if you're running this in a Jupyter notebook or Google Colab session, you can click on a cell and then shift+Enter to run the cell and automatically select the next cell. Alt+Enter will run a cell and create a new cell below it...
VUInformationRetrieval/IR2016_2017
make_dataset.ipynb
gpl-2.0
from Bio import Entrez # NCBI requires you to set your email address to make use of NCBI's E-utilities Entrez.email = "Your.Name.Here@example.org" """ Explanation: Building the dataset of research papers The Entrez module, a part of the Biopython library, will be used to interface with PubMed.<br> You can download Bi...
jaduimstra/nilmtk
notebooks/experimental/mle.ipynb
apache-2.0
import numpy as np import pandas as pd from os.path import join from pylab import rcParams import matplotlib.pyplot as plt %matplotlib inline rcParams['figure.figsize'] = (13, 6) #plt.style.use('ggplot') from datetime import datetime as datetime2 from datetime import timedelta import nilmtk from nilmtk.disaggregate.ma...
rashikaranpuria/Machine-Learning-Specialization
Clustering_&_Retrieval/Week6/.ipynb_checkpoints/6_hierarchical_clustering_blank-checkpoint.ipynb
mit
import graphlab import matplotlib.pyplot as plt import numpy as np import sys import os import time from scipy.sparse import csr_matrix from sklearn.cluster import KMeans from sklearn.metrics import pairwise_distances %matplotlib inline """ Explanation: Hierarchical Clustering Hierarchical clustering refers to a class...
gregstarr/PyGPS
Examples/.ipynb_checkpoints/Combining Pseudorange and Phase-checkpoint.ipynb
agpl-3.0
files = glob("/home/greg/Documents/Summer Research/rinex files/ma*") poop=rinexobs(files[6]) plt.figure(figsize=(14,14)) ax1 = plt.subplot(211) ax1.xaxis.set_major_formatter(fmt) plt.plot(2.85*(poop[:,23,'P2','data']*1.0E9/3.0E8-poop[:,23,'C1','data']*1.0E9/3.0E8)[10:], '.',markersize=3,label='pr tec') plt.p...
tiagoft/curso_audio
afinacao.ipynb
mit
referencia_inicial = 440.0 # Hz frequencias = [] # Esta lista recebera todas as frequencias de uma escala f = referencia_inicial while len(frequencias) < 12: if f > (referencia_inicial * 2): f /= 2. frequencias.append(f) f *= (3/2.) frequencias.sort() print frequencias print f """ Explanation: A...
suresh/notes
python/In Depth - Kernel Density Estimation.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import seaborn as sns; sns.set() import numpy as np import pandas as pd """ Explanation: Gaussian Mixture Models (GMM) are a kind of hybrid between a clustering estimator and a density estimator. Density estimator is an algorithm which takes a D-dimensional dataset an...
DawesLab/LabNotebooks
Double Slit Correlation Model.ipynb
mit
import matplotlib.pyplot as plt import numpy as np import scipy.stats as sp from numpy import pi, sin, cos, linspace, exp, real, imag, abs, conj, meshgrid, log, log10, angle, zeros, complex128, random from numpy.fft import fft, fftshift, ifft from mpl_toolkits.mplot3d import axes3d import BeamOptics as bopt %matplot...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_lcmv_beamformer.ipynb
bsd-3-clause
# Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import matplotlib.pyplot as plt import numpy as np import mne from mne.datasets import sample from mne.beamformer import lcmv print(__doc__) data_path = sample.data_path() raw_fname = data_path + '/MEG/sample/sample_a...
sdpython/actuariat_python
_doc/notebooks/sessions/seance5_approche_fonctionnelle_enonce.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') import pyensae from pyquickhelper.helpgen import NbImage from jyquickhelper import add_notebook_menu add_notebook_menu() from actuariat_python.data import table_mortalite_euro_stat table_mortalite_euro_stat() import pandas df = pandas.read_csv...
domino14/macondo
notebooks/preendgame_heuristics/preendgame_heuristics.ipynb
gpl-3.0
from copy import deepcopy import csv from datetime import date import numpy as np import pandas as pd import seaborn as sns import time log_folder = '../logs/' log_file = log_folder + 'log_20200515_preendgames.csv' todays_date = date.today().strftime("%Y%m%d") final_spread_dict = {} out_first_dict = {} win_dict = {}...
gwu-libraries/notebooks
20170720-building-social-network-graphs-CSV.ipynb
mit
import sys import json import re import numpy as np from datetime import datetime import pandas as pd tweetfile = '/home/soominpark/sfmproject/Work/Network Graphs/food_security.csv' tweets = pd.read_csv(tweetfile) """ Explanation: Exports nodes and edges from tweets (Retweets, Mentions, or Replies) [CSV] Exports n...
KUrushi/knocks
chapter2/UNIX command.ipynb
mit
with open("hightemp.txt") as f: count = len(f.readlines()) print(count) """ Explanation: 10. 行数のカウント 行数をカウントせよ.確認にはwcコマンドを用いよ End of explanation """ %%bash wc -l hightemp.txt """ Explanation: wc ファイル内のバイト数, 単語数, 及び行数を集計し表示する. また, 空白で区切られたものを単語として扱う. 表示: 行数 単語数 バイト数 wc [-clw] [--bytes] [--chars] [--lines] [--wor...
mne-tools/mne-tools.github.io
0.22/_downloads/f094864c4eeae2b4353a90789dd18b2b/plot_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' ...
planet-os/notebooks
api-examples/Metno_wind_demo.ipynb
mit
%matplotlib notebook import urllib.request import numpy as np import simplejson as json import matplotlib.pyplot as plt import matplotlib.dates as mdates import warnings import datetime import dateutil.parser import matplotlib.cbook warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation) import reque...
tommyogden/maxwellbloch
docs/examples/mbs-lambda-weak-pulse-cloud-atoms-with-coupling-store.ipynb
mit
mb_solve_json = """ { "atom": { "fields": [ { "coupled_levels": [[0, 1]], "detuning": 0.0, "label": "probe", "rabi_freq": 1.0e-3, "rabi_freq_t_args": { "ampl": 1.0, "centre": 0.0, "fwhm": 1.0 }, "rabi...
InsightSoftwareConsortium/SimpleITK-Notebooks
Python/00_Setup.ipynb
apache-2.0
import importlib from distutils.version import LooseVersion # check that all packages are installed (see requirements.txt file) required_packages = { "jupyter", "numpy", "matplotlib", "ipywidgets", "scipy", "pandas", "numba", "multiprocess", "SimpleITK", } problem_packages = list()...
jhamrick/original-nbgrader
examples/grade_assignment/Submitted Assignment.ipynb
mit
NAME = "Jane Doe" COLLABORATORS = "n/a" """ Explanation: Example Assignment <a href="#Problem-1">Problem 1</a> <a href="#Problem-2">Problem 2</a> <a href="#Part-A">Part A</a> <a href="#Part-B">Part B</a> <a href="#Part-C">Part C</a> Before you turn this problem in, make sure everything runs as expected. First, re...
ES-DOC/esdoc-jupyterhub
notebooks/ipsl/cmip6/models/sandbox-2/aerosol.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ipsl', 'sandbox-2', 'aerosol') """ Explanation: ES-DOC CMIP6 Model Properties - Aerosol MIP Era: CMIP6 Institute: IPSL Source ID: SANDBOX-2 Topic: Aerosol Sub-Topics: Transport, Emissions, Conce...
mne-tools/mne-tools.github.io
0.24/_downloads/686e03eb7a01e30e026e3dd11e64df18/30_filtering_resampling.ipynb
bsd-3-clause
import os import numpy as np import matplotlib.pyplot as plt 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) # use just 6...
AlDanial/cloc
tests/inputs/Trapezoid_Rule.ipynb
gpl-2.0
%matplotlib inline import numpy as np import matplotlib.pyplot as plt def f(x): return (x-3)*(x-5)*(x-7)+85 x = np.linspace(0, 10, 200) y = f(x) """ Explanation: Basic Numerical Integration: the Trapezoid Rule A simple illustration of the trapezoid rule for definite integration: $$ \int_{a}^{b} f(x)\, dx \approx...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_source_label_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.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 from mne.minimum_norm import read_inverse_operator, source_induced_power print(__doc__) """ Explanation...
aje/POT
docs/source/auto_examples/plot_otda_d2.ipynb
mit
# Authors: Remi Flamary <remi.flamary@unice.fr> # Stanislas Chambon <stan.chambon@gmail.com> # # License: MIT License import matplotlib.pylab as pl import ot import ot.plot """ Explanation: OT for domain adaptation on empirical distributions This example introduces a domain adaptation in a 2D setting. It exp...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/miroc-es2l/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'miroc-es2l', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: MIROC Source ID: MIROC-ES2L Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy B...
dblyon/PandasIntro
Pandas_Introduction.ipynb
mit
%%javascript $.getScript('misc/kmahelona_ipython_notebook_toc.js') """ Explanation: <h1 id="tocheading">Table of Contents</h1> <div id="toc"></div> End of explanation """ from IPython.core.display import HTML HTML("<iframe src=https://jupyter.readthedocs.io/en/latest/_images/notebook_components.png width=800 height=...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_stats_cluster_1samp_test_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.time_frequency import tfr_morlet from mne.stats import permutation_cluster_1samp_test from mne.datasets import sample print(__doc__) """ Explanat...
dalya/WeirdestGalaxies
outlier_detection_RF_demo.ipynb
mit
%pylab inline import numpy import sklearn from sklearn.preprocessing import Imputer import matplotlib.pyplot as plt """ Explanation: Outlier Detection Algorithm with unsupervised Random Forest (RF) This notebook shows the basic steps for using the outlier detection algorithm we developped, based on unsupervised RF, an...
tuanavu/coursera-university-of-washington
machine_learning/1_machine_learning_foundations/assignment/week3/Analyzing product sentiment.ipynb
mit
import graphlab """ Explanation: Predicting sentiment from product reviews Fire up GraphLab Create End of explanation """ products = graphlab.SFrame('amazon_baby.gl/') """ Explanation: Read some product review data Loading reviews for a set of baby products. End of explanation """ products.head() """ Explanation...
mne-tools/mne-tools.github.io
0.17/_downloads/9460321824116e4964fbe6d88d27462e/plot_cluster_stats_evoked.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.stats import permutation_cluster_test from mne.datasets import sample print(__doc__) """ Explanation: Permutation F-test on sensor data with 1D c...
julienchastang/unidata-python-workshop
failing_notebooks/casestudy.ipynb
mit
import xarray ds = xarray.open_dataset('https://motherlode.ucar.edu/repository/opendap/41f2b38a-4e70-4135-8ff8-dbf3d1dcbfc1/entry.das', decode_times=False) print(ds) """ Explanation: netCDF File Visualization Case Study I was asked by a colleague to visualize data contained within this netCDF f...
mikarubi/notebooks
worker/notebooks/bolt/tutorials/basic-usage.ipynb
mit
from bolt import ones a = ones((2,3,4)) a.shape """ Explanation: Basic usage The primary object in Bolt is the Bolt array. We can construct these arrays using familiar operators (like zeros and ones), or from an existing array, and manipulate them like ndarrays whether in local or distributed settings. This notebook ...
xpharry/Udacity-DLFoudation
tutorials/intro-to-tensorflow/intro_to_tensorflow_solution.ipynb
mit
# Problem 1 - Implement Min-Max scaling for grayscale image data def normalize_grayscale(image_data): """ Normalize the image data with Min-Max scaling to a range of [0.1, 0.9] :param image_data: The image data to be normalized :return: Normalized image data """ a = 0.1 b = 0.9 grayscale...
chengsoonong/mclass-sky
projects/alasdair/notebooks/04_learning_curves.ipynb
bsd-3-clause
# remove after testing %load_ext autoreload %autoreload 2 import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from itertools import product from sklearn.svm import SVC, LinearSVC from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection impo...
automl/SpySMAC
examples/autopytorch/apt_notebook.ipynb
bsd-3-clause
# Remove the old example output import os import logging import tempfile import shutil log_dir = "logs/apt-cave-notebook/" rerun_apt = False logging.basicConfig(level=logging.DEBUG) from autoPyTorch import AutoNetClassification import os as os import openml import json from ConfigSpace.read_and_write import json as p...
JBed/Pandas_Analysis_Worksheet
Pandas_Worksheet_Solutions.ipynb
apache-2.0
import pandas as pd %matplotlib inline """ Explanation: Pandas Worksheet Solutions End of explanation """ df = pd.read_csv('nba-shot-logs.zip') """ Explanation: The goal of this worksheet is to provide practical examples of aggregating (with group by), plotting, and pivoting data with the Pandas Python package. Thi...
computational-class/cjc2016
code/04.PythonCrawler_beautifulsoup.ipynb
mit
import requests from bs4 import BeautifulSoup help(requests.get) url = 'http://computational-class.github.io/bigdata/data/test.html' content = requests.get(url) help(content) print(content.text) content.encoding """ Explanation: 数据抓取: Requests、Beautifulsoup、Xpath简介 王成军 wangchengjun@nju.edu.cn 计算传播网 http://comp...
TomAugspurger/PracticalPandas
Practical Pandas 01 - Reading the Data.ipynb
mit
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from IPython import display """ Explanation: Practical Pandas: Cycling (Part 1) This is the first post in a series where I'll show how I use pandas on real-world datasets. For this post, we'll look at data I collected with Cy...
zerothi/sids
docs/visualization/viz_module/showcase/PdosPlot.ipynb
lgpl-3.0
import sisl import sisl.viz # This is just for convenience to retreive files siesta_files = sisl._environ.get_environ_variable("SISL_FILES_TESTS") / "sisl" / "io" / "siesta" """ Explanation: PdosPlot End of explanation """ plot = sisl.get_sile(siesta_files / "SrTiO3.PDOS").plot(Erange=[-10,10]) """ Explanation: We ...
google/physics-math-tutorials
colabs/statistics1.ipynb
apache-2.0
import numpy as np def normalize(x): return x / np.sum(x) def posterior_covid(observed, prevalence=None, sensitivity=None): # observed = 0 for negative test, 1 for positive test # hidden state = 0 if no-covid, 1 if have-covid if sensitivity is None: sensitivity = 0.875 specificity = 0.975 TPR = sensit...
hankcs/HanLP
plugins/hanlp_demo/hanlp_demo/zh/tok_restful.ipynb
apache-2.0
pip install hanlp_restful -U """ Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/tok_restful.ipynb" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.sv...
pinga-lab/magnetic-ellipsoid
code/lambda_oblate_ellipsoids.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: $\lambda$ variable for oblate ellipsoids End of explanation """ a = 11. b = 20. x = 21. y = 23. z = 30. """ Explanation: Here, we follow the reasoning presented by Webster (1904) for analyzing the ellipsoidal coordinate $\lambd...
mne-tools/mne-tools.github.io
0.20/_downloads/3292f41d8bad9e2a2bc48714f7f39668/plot_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...
juanshishido/text-classification
notebooks/kaggle-writeup.ipynb
mit
%matplotlib inline import re import numpy as np import pandas as pd import matplotlib.pyplot as plt import nltk from nltk.corpus import stopwords from nltk.tokenize import regexp_tokenize from nltk.stem.porter import PorterStemmer from sklearn import cross_validation from sklearn.feature_extraction.text import TfidfV...
GoogleCloudPlatform/asl-ml-immersion
notebooks/recommendation_systems/labs/3_als_bqml_hybrid.ipynb
apache-2.0
PROJECT = !(gcloud config get-value core/project) PROJECT = PROJECT[0] %env PROJECT=$PROJECT """ Explanation: Hybrid Recommendations with the Movie Lens Dataset Note: It is recommended that you complete the companion als_bqml.ipynb notebook before continuing with this als_bqml_hybrid.ipynb notebook. This is, however,...
feststelltaste/software-analytics
prototypes/Reading Git logs with Pandas 2.0 with bonus.ipynb
gpl-3.0
import git GIT_REPO_PATH = r'../../spring-petclinic/' repo = git.Repo(GIT_REPO_PATH) git_bin = repo.git git_bin """ Explanation: Introduction Introduction There are multiple reasons for analyzing a version control system like your Git repository. See for example Adam Tornhill's book "Your Code as a Crime Scene" or h...
arruda/bgarena_analysis
notebooks/gametables_finished_games_by_elo_rating.ipynb
mit
%pylab inline import os from pandas import read_csv csv_files_location = "../bgarena_gatherer/db_backup/" game_tables_df = read_csv(os.path.join(csv_files_location, 'gametables.csv')) game_tables_df = game_tables_df.set_index("id") # remove non existing tables non_error_game_table_df = game_tables_df[game_tables_df[...
sys-bio/tellurium
examples/notebooks/core/tellurium_utility.ipynb
apache-2.0
%matplotlib inline from __future__ import print_function import tellurium as te # to get the tellurium version use print('te.__version__') print(te.__version__) # or print('te.getTelluriumVersion()') print(te.getTelluriumVersion()) # to print the full version info use print('-' * 80) te.printVersionInfo() print('-' *...
abulbasar/machine-learning
Spacy.ipynb
apache-2.0
sentence = """European authorities fined Google a record $5.1 billion on Wednesday for abusing its power in the mobile phone market and ordered the company to alter its practices""" """ Install spacy $ pip install spacy Download en_core_web_sm module $ python -m spacy download en_core_web_sm """ import spacy from ...
pvalienteverde/ElCuadernillo
ElCuadernillo/20160214_TensorFlowTutorialBasico/TensorFlow_Interactivo_IPython.ipynb
mit
import tensorflow as tf """ Explanation: Ejemplo de como correr interactivamente la libreria TensorFlow en IPython End of explanation """ sess = tf.InteractiveSession() x = tf.Variable([[2.0, 3.0],[4.0, 12.0]]) """ Explanation: De esta manera lanzar una sesion interactiva, util cuando queremos probar metodos End o...
robertoalotufo/ia898
src/h2stats.ipynb
mit
def h2stats(h): import numpy as np import ia898.src as ia hn = 1.0*h/h.sum() # compute the normalized image histogram v = np.zeros(11) # number of statistics # compute statistics n = len(h) # number of gray values v[0] = np.sum((np.arange(n)*hn)) # mean v[1] = np.sum(np.power((np.ara...
phoebe-project/phoebe2-docs
2.3/tutorials/general_concepts.ipynb
gpl-3.0
#!pip install -I "phoebe>=2.3,<2.4" """ Explanation: General Concepts: The PHOEBE Bundle HOW TO RUN THIS FILE: if you're running this in a Jupyter notebook or Google Colab session, you can click on a cell and then shift+Enter to run the cell and automatically select the next cell. Alt+Enter will run a cell and create...
mne-tools/mne-tools.github.io
0.17/_downloads/f12d4c974f9dc78c910e072ebccba291/plot_rereference_eeg.ipynb
bsd-3-clause
# Authors: Marijn van Vliet <w.m.vanvliet@gmail.com> # Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) import mne from mne.datasets import sample from matplotlib import pyplot as plt print(__doc__) # Setup for reading the raw data data_path = sample.data_path() raw_f...
fivetentaylor/rpyca
TGA_Testing.ipynb
mit
%matplotlib inline """ Explanation: Robust PCA Example Robust PCA is an awesome relatively new method for factoring a matrix into a low rank component and a sparse component. This enables really neat applications for outlier detection, or models that are robust to outliers. End of explanation """ import matplotlib....
google/making_with_ml
instafashion/scripts/getMatches.ipynb
apache-2.0
# For each fashion inspiration pic, check to make sure that it's # a "fashion" picture. Ignore all other pics storage_client = storage.Client() blobs = list(storage_client.list_blobs(INSPO_BUCKET, prefix=INSPO_SUBFOLDER)) uris = [os.path.join("gs://", blobs[0].bucket.name, x.name) for x in blobs if '.jpg' in x...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/plots_boxplots.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import statsmodels.api as sm """ Explanation: Box Plots The following illustrates some options for the boxplot in statsmodels. These include violin_plot and bean_plot. End of explanation """ data = sm.datasets.anes96.load_pandas() party_ID = np.a...
olgaliak/cntk-cyclegan
simpleGan/CNTK_206B_DCGAN.ipynb
mit
import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import os import cntk as C from cntk import Trainer from cntk.layers import default_options from cntk.device import set_default_device, gpu, cpu from cntk.initializer import normal from cntk.io import (MinibatchSource, CTFDeserializer, StreamD...
DistrictDataLabs/tribe
notebooks/Introduction to Networkx.ipynb
mit
%matplotlib inline import os import random import community import numpy as np import networkx as nx import matplotlib.pyplot as plt from tribe.utils import * from tribe.stats import * from operator import itemgetter ## Some Helper constants FIXTURES = os.path.join(os.getcwd(), "fixtures") # GRAPHML = os.path.join...
saketkc/notebooks
python/CrossValidated-222556.ipynb
bsd-2-clause
%pylab inline from __future__ import division import scipy as sp import seaborn as sns sns.set_style('whitegrid') sns.set_context('paper', font_scale=2) np.random.seed(42) def calculate_shannon_entropy(p): ''' Parameters ---------- p: list list of probability values such that sum(p) = 1 Re...
pombredanne/https-gitlab.lrde.epita.fr-vcsn-vcsn
doc/notebooks/automaton.is_accessible.ipynb
gpl-3.0
import vcsn """ Explanation: automaton.is_accessible Whether all its states are accessible, i.e., all its states can be reached from an initial state. Preconditions: - None See also: - automaton.accessible - automaton.is_coaccessible - automaton.trim Examples End of explanation """ %%automaton a context = "lal_char(...
geektoni/shogun
doc/ipython-notebooks/multiclass/Tree/DecisionTrees.ipynb
bsd-3-clause
import os import numpy as np import shogun as sg import matplotlib.pyplot as plt %matplotlib inline SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../../data') # training data train_income=['Low','Medium','Low','High','Low','High','Medium','Medium','High','Low','Medium', 'Medium','High','Low','Medium'] train_age ...
ls-cwi/eXamine
doc/tutorial/eXamineNotebook/eXamineTutorial.ipynb
gpl-2.0
# HTTP Client for Python import requests # Cytoscape port number PORT_NUMBER = 1234 BASE_URL = "https://raw.githubusercontent.com/ls-cwi/eXamine/master/data/" # The Base path for the CyRest API BASE = 'http://localhost:' + str(PORT_NUMBER) + '/v1/' #Helper command to call a command via HTTP POST def executeRestComm...
LSSTC-DSFP/LSSTC-DSFP-Sessions
Sessions/Session04/Day1/LSSTC-DSFP4-Juric-FrequentistAndBayes-01-Probability.ipynb
mit
# Generating some simple photon count data import numpy as np from scipy import stats np.random.seed(1) # for repeatability F_true = 1000 # true flux, say number of photons measured in 1 second N = 50 # number of measurements F = stats.poisson(F_true).rvs(N) # N measurements of the flux e = np.sqrt(F) # errors on ...
sdpython/ensae_teaching_cs
_doc/notebooks/td2a_ml/ml_b_imbalanced.ipynb
mit
from jyquickhelper import add_notebook_menu add_notebook_menu() %matplotlib inline """ Explanation: 2A.ml - Imbalanced dataset Un jeu de données imbalanced signifie qu'une classe est sous représentée dans un problème de classification. Lire 8 Tactics to Combat Imbalanced Classes in Your Machine Learning Dataset. End ...
luiscruz/udacity_data_analyst
P05/src/Data exploration.ipynb
mit
del data_dict['TOTAL'] df = pandas.DataFrame.from_dict(data_dict, orient='index') df.head() print "Dataset size: %d rows x %d columns"%df.shape df.dtypes print "Feature | Missing values" print "---|---" for column in df.columns: if column != 'poi': print "%s | %d"%(column,(df[column] == 'NaN').sum()) ...
paris-saclay-cds/python-workshop
Day_2_Software_engineering_best_practices/solutions/01_function_factorization.ipynb
bsd-3-clause
def read_spectra(path_csv): s = pandas.read_csv(path_csv) c = s['concentration'] m = s['molecule'] s = s['spectra'] x = [] for spec in s: x.append(numpy.fromstring(spec[1:-1], sep=',')) s = pandas.DataFrame(x) return s, c, m f = pandas.read_csv('data/freq.csv') filenames =...
tensorflow/probability
tensorflow_probability/examples/jupyter_notebooks/HLM_TFP_R_Stan.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...
cvxgrp/cvxpylayers
examples/jax/tutorial.ipynb
apache-2.0
import cvxpy as cp import numpy as np import jax import jax.numpy as jnp from cvxpylayers.jax import CvxpyLayer import matplotlib.pyplot as plt plt.style.use('bmh') np.set_printoptions(precision=2, suppress=True) """ Explanation: Differentiable Convex Optimization Layers: JAX Tutorial End of explanation """ # Imp...
amkatrutsa/MIPT-Opt
Spring2017-2019/18-LinProgPrimalInterior/Seminar18en.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import scipy.optimize as scopt import scipy.linalg as sclin USE_COLAB = False if not USE_COLAB: plt.rc("text", usetex=True) def NewtonLinConstraintsFeasible(f, gradf, hessf, A, x0, line_search, linsys_solver, args=(), ...
regata/dbda2e_py
chapters/10.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') import seaborn as sns import pystan as ps import numpy as np model_code = """ data { int N; int y[N]; real omega; real kappa; } parameters { real<lower=0,upper=1> theta; } model { real alpha; real beta; ...
lily-tian/fanfictionstatistics
jupyter_notebooks/profile_analysis.ipynb
mit
# opens raw data with open ('../data/clean_data/df_profile', 'rb') as fp: df = pickle.load(fp) # creates subset of data of active users df_active = df.loc[df.status != 'inactive', ].copy() # sets current year cyear = datetime.datetime.now().year # sets stop word list for text parsing stop_word_list = stopwor...
justiceamoh/ENGS108
vagrant/notebooks/Keras Introduction.ipynb
apache-2.0
%matplotlib inline # Standard Libraries import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set(style='ticks') """ Explanation: An Introduction to Keras In this notebook, I will provide a brief introduction to Keras, a high-level neural networks python library; it is a wrapper ontop of eithe...
svdwulp/da-programming-1
week_07_oefeningen-uitwerkingen.ipynb
gpl-2.0
# 1a pi_times_xi = [] for d1 in range(1, 7): pi_times_xi.append(d1 / 6) expected_value = sum(pi_times_xi) print("Expected value:", expected_value) # 1b pi_times_xi = [] for d1 in range(1, 7): for d2 in range(1, 7): for d3 in range(1, 7): pi_times_xi.append((d1 + d2 + d3) / (6**3)) expected_...
jonathanmorgan/msu_phd_work
analysis/step-1-sourcenet-to-context.ipynb
lgpl-3.0
me = "sourcenet-to-context" """ Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#notes-and-questions" data-toc-modified-id="notes-and-questions-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>notes and questions</a></span></li><li><span><a...
leyhline/vix-term-structure
comparison1-4.ipynb
mit
argmin_epchs_basic = np.array([v[3] for v in experiment1["val_loss"].loc[:,:,False].groupby(("depth", "width", "datetime")).idxmin()]) argmin_epchs_normal = np.array([v[3] for v in experiment1["val_loss"].loc[:,:,True].groupby(("depth", "width", "datetime")).idxmin()]) print(argmin_epchs_basic.mean(), argmin_epchs_basi...
yuhao0531/dmc
notebooks/week-4/01-tensorflow ANN for regression.ipynb
apache-2.0
%matplotlib inline import math import random import seaborn as sns import matplotlib.pyplot as plt import pandas as pd from sklearn.datasets import load_boston import numpy as np import tensorflow as tf sns.set(style="ticks", color_codes=True) """ Explanation: Lab 4 - Tensorflow ANN for regression In this lab we wi...
cloudmesh/book
notebooks/opencv/opencv.ipynb
apache-2.0
import os, sys from os.path import expanduser os.path home = expanduser("~") sys.path.append('/usr/local/Cellar/opencv/3.3.1_1/lib/python3.6/site-packages/') sys.path.append(home + '/.pyenv/versions/OPENCV/lib/python3.6/site-packages/') import cv2 cv2.__version__ """ Explanation: Open CV OpenCV (Open Source Computer ...
GoogleCloudPlatform/vertex-ai-samples
notebooks/community/gapic/automl/showcase_automl_image_segmentation_online.ipynb
apache-2.0
import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG """ Explanation: Vertex client library: AutoML image segmentation model for online prediction <table align="...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_decoding_sensors.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Jean-Remi King <jeanremi.king@gmail.com> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample from mne.decoding import TimeDecoding print(__doc__) data_path = sampl...
amueller/scipy-2017-sklearn
notebooks/22.Unsupervised_learning-anomaly_detection.ipynb
cc0-1.0
%matplotlib inline import warnings warnings.filterwarnings("ignore") import numpy as np import matplotlib import matplotlib.pyplot as plt """ Explanation: Anomaly detection Anomaly detection is a machine learning task that consists in spotting so-called outliers. “An outlier is an observation in a data set which app...
matthiaskoenig/sbmlutils
src/sbmlutils/examples/van_der_pol/van_der_pol.ipynb
lgpl-3.0
# print settings for notebook %matplotlib inline import matplotlib matplotlib.rcParams; # available global parameters matplotlib.rcParams['figure.figsize'] = (9.0, 6.0) matplotlib.rcParams['axes.labelsize'] = 'medium' font = {'family' : 'sans-serif', 'weight' : 'normal', # bold 'size' : 14} matplo...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_time_frequency_global_field_power.ipynb
bsd-3-clause
# Authors: Denis A. Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import somato from mne.baseline import rescale from mne.stats import _bootstrap_ci """ Explanation: Explore event-related dynamics for specific frequency...
msampathkumar/kaggle-quora-tensorflow
preprocessor.ipynb
apache-2.0
df_train = pd.read_csv(TRAIN_CSV) df_test = pd.read_csv(TEST_CSV) # Train Data train_feature_1_string = pd.Series(df_train['question1'].tolist()).astype(str) train_feature_2_string = pd.Series(df_train['question2'].tolist()).astype(str) target = pd.Series(df_train['is_duplicate'].tolist()) all_train_qs = train_featu...
Kusdhill/bioapi-examples
python_notebooks/1kg.ipynb
apache-2.0
import ga4gh.client as client c = client.HttpClient("http://1kgenomes.ga4gh.org/") """ Explanation: GA4GH 1000 Genome Examples Variant data from the Thousand Genomes project is being served by the GA4GH reference server. In this example we show how to use the GA4GH client to access the data. Initialize the client In t...
minh5/cpsc
reports/api data.ipynb
mit
import pickle import operator import numpy as np import pandas as pd import gensim.models data = pickle.load(open('/home/datauser/cpsc/data/processed/cleaned_api_data', 'rb')) data.head() """ Explanation: Introduction This notebook serves as a reporting tool for the CPSC. In this notebook, I laid out the questions ...
andre-martini/advanced-comp-2017
02-trees/splitting-criteria.ipynb
gpl-3.0
X = np.array([[0,0,0], [0,0,1], [0,1,0], [0,1,1], [0,1,1], [1,0,0], [1,0,0], [1,0,0], [1,0,0], [1,1,1]]) # two class problem with classes 0 and 1 y = [0,0,1,1,1,1,1,1,1,1] def accuracy(a, b): N = a + b return 1 - max(a/N, b/N) def entropy(a, b): p = b/(a + b) # fraction or probability for c...
rasilab/ferrin_elife_2017
scripts/fit_simulation_to_experiment.ipynb
gpl-3.0
import pandas as pd import re import os import numpy as np import simulation_utils from scipy.interpolate import interp1d """ Explanation: Fit simulation results to experiment <div id="toc-wrapper"><h3> Table of Contents </h3><div id="toc" style="max-height: 787px;"><ol class="toc-item"><li><a href="#Globals">Globals<...
kit-cel/wt
wt/vorlesung/ch1_3/relative_frequency.ipynb
gpl-2.0
# importing import numpy as np import matplotlib.pyplot as plt import matplotlib # showing figures inline %matplotlib inline # plotting options font = {'size' : 20} plt.rc('font', **font) plt.rc('text', usetex=True) matplotlib.rc('figure', figsize=(18, 6) ) """ Explanation: Content and Objective Plotting relat...
barjacks/pythonrecherche
Kursteilnehmer/Dominique Strebel/06/Python Functions, 10 Übungen.ipynb
mit
def test(element): element = element * 2 return element """ Explanation: 03 Python Functions, 10 Übungen Hier nochmals zur Erinnerung, wie Funktionen geschrieben werden. End of explanation """ test(5) """ Explanation: Multipliziert Integers oder Floats mit 2 End of explanation """ lst = [3,7,14,222,6] lst...
sassoftware/sas-viya-programming
recommend/bx_recommender.ipynb
apache-2.0
import html import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import re import swat from IPython.core.display import display, HTML, Markdown from io import StringIO %matplotlib inline """ Explanation: Build a Recommender System for Books This notebook demonstrates the use of man...
ES-DOC/esdoc-jupyterhub
notebooks/bnu/cmip6/models/sandbox-3/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bnu', 'sandbox-3', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: BNU Source ID: SANDBOX-3 Topic: Land Sub-Topics: Soil, Snow, Vegetation, Energy Balance...
SHDShim/pytheos
examples/11_pvt-eos_fit-el_anh.ipynb
apache-2.0
%config InlineBackend.figure_format = 'retina' """ Explanation: For high dpi displays. End of explanation """ import numpy as np import matplotlib.pyplot as plt import uncertainties as uct from uncertainties import unumpy as unp import pytheos as eos """ Explanation: 0. General note This notebook shows an example...
exe0cdc/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) [2,3]. This entails the generation data needed to draw rate characteristic plots for all the variable species of metabolic model through parameter scans and t...
qinwf-nuan/keras-js
notebooks/layers/wrappers/TimeDistributed.ipynb
mit
data_in_shape = (3, 6) layer_0 = Input(shape=data_in_shape) layer_1 = TimeDistributed(Dense(4))(layer_0) model = Model(inputs=layer_0, outputs=layer_1) # set weights to random (use seed for reproducibility) weights = [] for i, w in enumerate(model.get_weights()): np.random.seed(4000 + i) weights.append(2 * np...
martin-hunt/hublib
hublib/rappture/test/CompositeLaminate.ipynb
mit
import os, sys import numpy as np import matplotlib import matplotlib.pyplot as plt sys.path.insert(0, os.path.abspath('../../..')) import hublib.rappture as rappture io = rappture.Tool("complam") io.inputs """ Explanation: Composite laminate Starting from a list of properties for the matrix and fibers we use rules ...
tanghaibao/goatools
notebooks/cell_cycle.ipynb
bsd-2-clause
# Get http://geneontology.org/ontology/go-basic.obo from goatools.base import download_go_basic_obo obo_fname = download_go_basic_obo() """ Explanation: Cell Cycle genes Using Gene Ontologies (GO), create an up-to-date list of all human protein-coding genes that are know to be associated with cell cycle. 1. Download O...
ES-DOC/esdoc-jupyterhub
notebooks/cccr-iitm/cmip6/models/sandbox-1/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccr-iitm', 'sandbox-1', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: CCCR-IITM Source ID: SANDBOX-1 Topic: Seaice Sub-Topics: Dynamics, Thermodyna...
mne-tools/mne-tools.github.io
0.19/_downloads/9256698a6dc1e67585812dacb4e9f960/plot_elekta_epochs.ipynb
bsd-3-clause
# Author: Jussi Nurminen (jnu@iki.fi) # # License: BSD (3-clause) import mne import os from mne.datasets import multimodal fname_raw = os.path.join(multimodal.data_path(), 'multimodal_raw.fif') print(__doc__) """ Explanation: ====================================== Getting averaging info from .fif files ==========...
visualfabriq/bquery
bquery/benchmarks/bench_groupby.ipynb
bsd-3-clause
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import itertools as itt import time import shutil import os import contextlib import pandas as pd import blaze as blz import bquery import cytoolz from cytoolz.curried import pluck as cytoolz_pluck from collections import OrderedDict import copy fro...
csaladenes/csaladenes.github.io
present/mcc2/sklearn_tutorial/04.1-Dimensionality-PCA.ipynb
mit
from __future__ import print_function, division %matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy import stats plt.style.use('seaborn') """ Explanation: Dénes Csala MCC, 2022 Based on Elements of Data Science (Allen B. Downey, 2021) and Python Data Science Handbook (Jake VanderPlas, ...
dariox2/CADL
session-5/.ipynb_checkpoints/lecture-5-checkpoint.ipynb
apache-2.0
import tensorflow as tf from libs.datasets import CELEB files = CELEB() """ Explanation: Session 5: Generative Models <p class="lead"> <a href="https://www.kadenze.com/courses/creative-applications-of-deep-learning-with-tensorflow/info">Creative Applications of Deep Learning with Google's Tensorflow</a><br /> <a href=...