repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
GoogleCloudPlatform/asl-ml-immersion
notebooks/image_models/labs/4_tpu_training.ipynb
apache-2.0
import os PROJECT = !(gcloud config get-value core/project) PROJECT = PROJECT[0] BUCKET = PROJECT os.environ["BUCKET"] = BUCKET """ Explanation: Transfer Learning on TPUs In the <a href="3_tf_hub_transfer_learning.ipynb">previous notebook</a>, we learned how to do transfer learning with TensorFlow Hub. In this noteb...
AllenDowney/ThinkStats2
solutions/chap11soln.ipynb
gpl-3.0
from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename): from urllib.request import urlretrieve local, _ = urlretrieve(url, filename) print("Downloaded " + local) download("https://github.com/AllenDowney/ThinkStats2/raw/master/code/th...
analysiscenter/dataset
examples/experiments/zeroing_of_weights/zeroing_of_weights.ipynb
apache-2.0
import sys import copy import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.cluster import KMeans from tqdm import tqdm_notebook as tqn %matplotlib inline sys.path.append('../../..') from simple_model import ConvModel from batchflow.opensets import MNIST from batchflow import V, B ...
IS-ENES-Data/submission_forms
dkrz_forms/Templates/CMIP6_submission_form.ipynb
apache-2.0
# Evaluate this cell to identifiy your form from dkrz_forms import form_widgets, form_handler, checks form_infos = form_widgets.show_selection() # Evaluate this cell to generate your personal form instance form_info = form_infos[form_widgets.FORMS.value] sf = form_handler.init_form(form_info) form = sf.sub.entity_o...
RoebideBruijn/datascience-intensive-course
project/notebooks/project-milestone-report.ipynb
mit
%matplotlib inline import pandas as pd import numpy as np from matplotlib import pyplot as plt import matplotlib.dates as mdates import seaborn as sns sns.set_style('white') """ Explanation: Milestone report Instruction You have proposed a project, collected a data set, cleaned up the data and explored it with descr...
harmsm/pythonic-science
chapters/00_inductive-python/04_loops.ipynb
unlicense
for i in range(10): print(i) for i in range(15): print(i) """ Explanation: Loops Loops let you execute code over and over. Basic Loops Predict What will this code do? End of explanation """ for i in range(11): print(i) """ Explanation: Summarize What does the range function do? Modify Change the cell ...
ES-DOC/esdoc-jupyterhub
notebooks/nerc/cmip6/models/hadgem3-gc31-hm/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nerc', 'hadgem3-gc31-hm', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: NERC Source ID: HADGEM3-GC31-HM Topic: Land Sub-Topics: Soil, Snow, Vegetation, ...
HeyIamJames/bikeshare
BikeShareStep3.ipynb
mit
station_counts = usage.groupby('station_start')['station_start'].count() station_rentals_per_day = DataFrame() station_rentals_per_day['rentals'] = station_counts.values / 366.0 station_rentals_per_day['station'] = station_counts.index station_rentals_per_day.head() """ Explanation: To start with, we'll need to com...
kwhanalytics/rdtools
docs/degradation_example.ipynb
mit
from datetime import timedelta import pandas as pd import matplotlib.pyplot as plt import numpy as np import pvlib %matplotlib inline #Update the style of plots import matplotlib matplotlib.rcParams.update({'font.size': 12, 'figure.figsize': [4.5, 3], 'lines.marker...
mne-tools/mne-tools.github.io
dev/_downloads/da444a4db06576d438b46fdb32d045cd/topo_compare_conditions.ipynb
bsd-3-clause
# Authors: Denis Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD-3-Clause import matplotlib.pyplot as plt import mne from mne.viz import plot_evoked_topo from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ Explanation: Co...
ES-DOC/esdoc-jupyterhub
notebooks/cccma/cmip6/models/sandbox-2/ocnbgchem.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'cccma', 'sandbox-2', 'ocnbgchem') """ Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: CCCMA Source ID: SANDBOX-2 Topic: Ocnbgchem Sub-Topics: Tracers. Propertie...
JAmarel/Phys202
Optimization/OptimizationEx01.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.optimize as opt from scipy.optimize import minimize """ Explanation: Optimization Exercise 1 Imports End of explanation """ def hat(x,a,b): return -a*x**2 + b*x**4 assert hat(0.0, 1.0, 1.0)==0.0 assert hat(0.0, 1.0, 1.0)==0.0 ass...
huseinzol05/Deep-Learning-Tensorflow
Seq-to-Seq/Basic-Seq2Seq/basic sequence-to-sequence.ipynb
mit
with open('/home/huseinzol05/AI/chat/Assassination Classroom The Graduation (2016) BluRay 720p 900MB Ganool is.srt', 'r') as fopen: text = fopen.read().split('\n') text = filter(None, text) # any first character in a string is digit or '\r' or '<', we remove the string # but we must start from the back, or later p...
tensorflow/docs-l10n
site/ja/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...
opesci/devito
examples/mpi/overview.ipynb
mit
import ipyparallel as ipp c = ipp.Client(profile='mpi') """ Explanation: Prerequisites This notebook contains examples which are expected to be run with exactly 4 MPI processes; not because they wouldn't work otherwise, but simply because it's what their description assumes. For this, you need to: Install an MPI dist...
rajul/tvb-library
tvb/simulator/demos/Monitoring with transformations.ipynb
gpl-2.0
sim = simulator.Simulator( model=models.Generic2dOscillator(), connectivity=connectivity.Connectivity(load_default=True), coupling=coupling.Linear(), integrator=integrators.EulerDeterministic(), monitors=Raw(pre_expr='V;W;V**2;W-V', post_expr=';;sin(mon);exp(mon)')) sim.configure() ts, ys = [], []...
caisq/tensorflow
tensorflow/contrib/eager/python/examples/notebooks/eager_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 under...
ML4DS/ML4all
TM3.Topic_Models_with_MLlib/ExB3_TopicModels/.ipynb_checkpoints/TM_Exam2-checkpoint.ipynb
mit
#nltk.download() mycorpus = nltk.corpus.reuters """ Explanation: Master Telefónica Big Data & Analytics Prueba de Evaluación del Tema 4: Topic Modelling. Date: 2016/04/10 Para realizar esta prueba es necesario tener actualizada la máquina virtual con la versión más reciente de MLlib. Para la actualización, debe segui...
lekshmideepu/nest-simulator
doc/userdoc/model_details/aeif_models_implementation.ipynb
gpl-2.0
# Install assimulo package in the current Jupyter kernel import sys !{sys.executable} -m pip install assimulo import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt %matplotlib inline plt.rcParams['figure.figsize'] = (15, 6) """ Explanation: NEST implementation of the aeif models Hans E...
leriomaggio/python-in-a-notebook
07 More Functions.ipynb
mit
def thank_you(name): # This function prints a two-line personalized thank you message. print("\nYou are doing good work, %s!" % name) print("Thank you very much for your efforts on this project.") thank_you('Adriana') thank_you('Billy') thank_you('Caroline') """ Explanation: More Functions Earlier we ...
kuo77122/deep-learning-nd
Lesson15-TFLearn/Sentiment Analysis with TFLearn.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w...
pycroscopy/pycroscopy
jupyter_notebooks/AFM_simulations/IntroductionToSimulations/IntroToAFMSimulations.ipynb
mit
from __future__ import division, print_function, absolute_import, unicode_literals import os import numpy import matplotlib.pyplot as plt %matplotlib inline from IPython.display import Image path = os.getcwd() fig1 = path + '/Fig1.jpg' Image(filename=fig1) """ Explanation: Introduction to dynamic AFM simulations Cont...
rflamary/POT
notebooks/plot_gromov_barycenter.ipynb
mit
# Author: Erwan Vautier <erwan.vautier@gmail.com> # Nicolas Courty <ncourty@irisa.fr> # # License: MIT License import numpy as np import scipy as sp import scipy.ndimage as spi import matplotlib.pylab as pl from sklearn import manifold from sklearn.decomposition import PCA import ot """ Explanation: Gromov...
nfaggian/notebooks
Introductions/.ipynb_checkpoints/Tutorial - 1.0 - Introduction-checkpoint.ipynb
apache-2.0
print("Hello World") """ Explanation: Welcome to the interactive Python session. This notebook series is intended as a very high-level introduction to python and tools, for a more comprehensive set of material refer to the following reference: https://wiki.python.org/moin/BeginnersGuide/Programmers Also, consider work...
M-R-Houghton/euroscipy_2015
scikit_image/lectures/example_pano.ipynb
mit
import numpy as np import matplotlib.pyplot as plt from skimage import io, transform from skimage.color import rgb2gray from skdemo import imshow_all ic = io.ImageCollection('../images/pano/DFM_*') """ Explanation: Note: This example has been significantly expanded and enhanced. The new, recommended version is locate...
statsmodels/statsmodels.github.io
v0.13.0/examples/notebooks/generated/statespace_structural_harvey_jaeger.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt from IPython.display import display, Latex """ Explanation: Detrending, Stylized Facts and the Business Cycle In an influential article, Harvey and Jaeger (1993) described the use of unobserved comp...
opencobra/cobrapy
documentation_builder/gapfilling.ipynb
gpl-2.0
from cobra.io import load_model from cobra.flux_analysis import gapfill model = load_model("iYS1720") """ Explanation: Gapfillling Model gap filling is the task of figuring out which reactions have to be added to a model to make it feasible. Several such algorithms have been reported e.g. Kumar et al. 2009 and Reed et...
therealAJ/python-sandbox
data-science/learning/ud2/Part 1 Exercise Solutions/Ecommerce Purchases Exercise .ipynb
gpl-3.0
import pandas as pd ecom = pd.read_csv('Ecommerce Purchases') """ Explanation: <a href='http://www.pieriandata.com'> <img src='../../Pierian_Data_Logo.png' /></a> Ecommerce Purchases Exercise In this Exercise you will be given some Fake Data about some purchases done through Amazon! Just go ahead and follow the dire...
mne-tools/mne-tools.github.io
0.14/_downloads/plot_evoked_delayed_ssp.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne import io from mne.datasets import sample print(__doc__) data_path = sample.data_path() """ Explanation: Create...
bayesimpact/bob-emploi
data_analysis/notebooks/datasets/rome/update_from_v339_to_v341.ipynb
gpl-3.0
import collections import glob import os from os import path import matplotlib_venn import pandas as pd rome_path = path.join(os.getenv('DATA_FOLDER'), 'rome/csv') OLD_VERSION = '339' NEW_VERSION = '341' old_version_files = frozenset(glob.glob(rome_path + '/*{}*'.format(OLD_VERSION))) new_version_files = frozenset(...
walkon302/CDIPS_Recommender
notebook_versions/Recommendor_Method_Nathans_v1.ipynb
apache-2.0
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set_style('white') %matplotlib inline """ Explanation: Recommendation Method 1: Most similar items to user's previous views Algorithm Offline: 1. For each item, calculate features on trained neural network $ f_j $ 2. For ...
ES-DOC/esdoc-jupyterhub
notebooks/csir-csiro/cmip6/models/vresm-1-0/land.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'csir-csiro', 'vresm-1-0', 'land') """ Explanation: ES-DOC CMIP6 Model Properties - Land MIP Era: CMIP6 Institute: CSIR-CSIRO Source ID: VRESM-1-0 Topic: Land Sub-Topics: Soil, Snow, Vegetation, ...
ad960009/dist-keras
examples/mnist_analysis.ipynb
gpl-3.0
!(date +%d\ %B\ %G) """ Explanation: MNIST Analysis with Distributed Keras Joeri Hermans (Technical Student, IT-DB-SAS, CERN) Departement of Knowledge Engineering Maastricht University, The Netherlands End of explanation """ %matplotlib inline import numpy as np from keras.optimizers import * fro...
myuuuuun/NumericalCalculation
chapter2/Chapter2.ipynb
mit
#!/usr/bin/python #-*- encoding: utf-8 -*- """ Copyright (c) 2015 @myuuuuun https://github.com/myuuuuun/NumericalCalculation This software is released under the MIT License. """ %matplotlib inline from __future__ import division, print_function import math import numpy as np import functools import sys import types im...
tensorflow/docs-l10n
site/ja/agents/tutorials/10_checkpointer_policysaver_tutorial.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...
xlbaojun/Note-jupyter
05其他/pandas文档-zh-master/检索 ,查询数据.ipynb
gpl-2.0
import numpy as np import pandas as pd """ Explanation: 检索,查询数据 这一节学习如何检索pandas数据。 End of explanation """ dates = pd.date_range('1/1/2000', periods=8) dates df = pd.DataFrame(np.random.randn(8,4), index=dates, columns=list('ABCD')) df panel = pd.Panel({'one':df, 'two':df-df.mean()}) panel """ Explanation: Python...
mjlong/openmc
docs/source/pythonapi/examples/post-processing.ipynb
mit
from IPython.display import Image import numpy as np import matplotlib.pyplot as plt import openmc from openmc.statepoint import StatePoint %matplotlib inline """ Explanation: This notebook demonstrates some basic post-processing tasks that can be performed with the Python API, such as plotting a 2D mesh tally and p...
ImAlexisSaez/deep-learning-specialization-coursera
course_1/week_4/assignment_1/building_your_deep_neural_network_step_by_step_v3.ipynb
mit
import numpy as np import h5py import matplotlib.pyplot as plt from testCases_v2 import * from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] = 'nearest' plt.rcParams['imag...
dbenn/photometry_tools
SkyCoordAperturePhotometry.ipynb
mit
import os from random import random # TODO: shouldn't need ordered dictionary now either from collections import OrderedDict import numpy as np import pandas as pd from astropy.io import fits from astropy.visualization import astropy_mpl_style import matplotlib.pyplot as plt from matplotlib.colors import LogNorm fro...
jessicaowensby/We-Rise-Keras
notebooks/05_Transfer_Learning.ipynb
apache-2.0
from __future__ import print_function import datetime import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers import Conv2D, MaxPooling2D from keras.preprocessing import image from keras.applications.imagenet_utils...
claudiuskerth/PhDthesis
Data_analysis/SNP-indel-calling/dadi/dadiExercises/example_YRI_CEU.ipynb
mit
%pwd import dadi """ Explanation: Table of Contents <p><div class="lev2 toc-item"><a data-toc-modified-id="Load-dadi-module-01" href="#Load-dadi-module"><span class="toc-item-num">0.1&nbsp;&nbsp;</span>Load dadi module</a></div><div class="lev2 toc-item"><a data-toc-modified-id="Import-custom-models-02" href="#Import...
kingmolnar/DataScienceProgramming
02-Python/Introduction_class.ipynb
cc0-1.0
x = 7+3 print x, type(x) print x x = (x+5)*0.5 print x, type(x) type(x) """ Explanation: <p style="text-align:right;color:red;font-weight:bold;font-size:16pt;padding-bottom:20px">Please, rename this notebook before editing!</p> The Programming Language Python References Here are some references to freshen up on co...
ML4DS/ML4all
U_lab1.Clustering/Lab_ShapeSegmentation_draft/LabSessionClustering[Conflicto].ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.misc import imread """ Explanation: Lab Session: Clustering algorithms for Image Segmentation Author: Jesús Cid Sueiro Jan. 2017 End of explanation """ name = "birds.jpg" name = "Seeds.jpg" birds = imread("Images/" + name) birdsG = np....
ireapps/cfj-2017
exercises/06. pandas? pandas! (Part 2)-working.ipynb
mit
# to avoid errors with the FDA files, we're going to specify the encoding # as latin_1, which is common with gov't data # so it's a decent educated guess to start with # main dataframe # country code lookup dataframe # refusal code lookup dataframe # specify that the 'ASC_ID' column comes in as a string # because ...
albahnsen/PracticalMachineLearningClass
notebooks/11-Ensembles_Bagging.ipynb
mit
import numpy as np # set a seed for reproducibility np.random.seed(1234) # generate 1000 random numbers (between 0 and 1) for each model, representing 1000 observations mod1 = np.random.rand(1000) mod2 = np.random.rand(1000) mod3 = np.random.rand(1000) mod4 = np.random.rand(1000) mod5 = np.random.rand(1000) # each m...
tpin3694/tpin3694.github.io
python/pandas_list_unique_values_in_column.ipynb
mit
# Import modules import pandas as pd # Set ipython's max row display pd.set_option('display.max_row', 1000) # Set iPython's max column width to 50 pd.set_option('display.max_columns', 50) """ Explanation: Title: List Unique Values In A Pandas Column Slug: pandas_list_unique_values_in_column Summary: List Unique Valu...
wuafeing/Python3-Tutorial
02 strings and text/02.03 match strings with shell wildcard.ipynb
gpl-3.0
from fnmatch import fnmatch, fnmatchcase fnmatch("foo.txt", "*.txt") fnmatch("foo.txt", "?oo.txt") fnmatch("Dat45.csv", "Dat[0-9]*") names = ["Dat1.csv", "Dat2.csv", "config.ini", "foo.py"] [name for name in names if fnmatch(name, "Dat*.csv")] """ Explanation: Previous 2.3 用Shell通配符匹配字符串 问题 你想使用 Unix Shell 中常用的通配符(...
cliburn/sta-663-2017
notebook/18E_Spark_SQL.ipynb
mit
from pyspark import SparkContext, SparkConf conf = (SparkConf() .setAppName('SparkSQL') .setMaster('local[*]')) sc = SparkContext(conf=conf) from pyspark.sql import SQLContext sqlc = SQLContext(sc) """ Explanation: Spark SQL Official Documentation A tour of the Spark SQL library, the spark-csv pac...
Leguark/GeMpy
Prototype Notebook/.ipynb_checkpoints/Sandstone Project_legacy-checkpoint.ipynb
mit
T.jacobian? # Setting extend, grid and compile # Setting the extent sandstone = GeoMig.Interpolator(696000,747000,6863000,6950000,-20000, 2000, range_var = np.float32(110000), u_grade = 9) # Range used in geomodeller # Setting resolution of the grid sands...
Cyb3rWard0g/ThreatHunter-Playbook
docs/notebooks/windows/08_lateral_movement/WIN-200902020333.ipynb
gpl-3.0
from openhunt.mordorutils import * spark = get_spark() """ Explanation: Remote WMI ActiveScriptEventConsumers Metadata | | | |:------------------|:---| | collaborators | ['@Cyb3rWard0g', '@Cyb3rPandaH'] | | creation date | 2020/09/02 | | modification date | 2020/09/20 | | playbook related ...
davicsilva/dsintensive
notebooks/eda-miniprojects/racial_disc/sliderule_dsi_inferential_statistics_exercise_2-Copy1.ipynb
apache-2.0
import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: Examining Racial Discrimination in the US Job Market Background Racial discrimination continues to be pervasive in cultures throughout the world. Researchers examined...
HuanglabPurdue/NCS
clib/jupyter_notebooks/ncs_tensorflow_simulation.ipynb
gpl-3.0
import matplotlib import matplotlib.pyplot as pyplot import numpy import os import time # tensorflow import tensorflow as tf from tensorflow.python.training import adagrad from tensorflow.python.training import adam from tensorflow.python.training import gradient_descent # python3-6 NCS. This provideds the OTF and th...
neurohackweek/kids_rsfMRI_motion
split_half_reliability/Development_Abide_Motion_Wrapper.ipynb
mit
import matplotlib.pylab as plt %matplotlib inline from matplotlib import ticker from glob import glob import numpy as np import os import pandas as pd from scipy.stats import linregress, pearsonr, spearmanr import nibabel as nib import urllib import seaborn as sns sns.set_context('notebook', font_scale=2) sns.set_style...
GoogleCloudPlatform/vertex-ai-samples
notebooks/official/migration/UJ9 Vertex SDK Custom XGBoost with pre-built training container.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 AI: Vertex AI Migration: Custom XGBoost model with pre-built training container <table a...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/introduction_to_tensorflow/labs/1_core_tensorflow.ipynb
apache-2.0
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst # Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.5 import numpy as np from matplotlib import pyplot as plt import tensorflow as tf print(tf.__version__) """ Explanation: Getting started with TensorFlow Learning...
idekerlab/cyrest-examples
notebooks/cookbook/Python-cookbook/Export.ipynb
mit
# import data from url from py2cytoscape.data.cyrest_client import CyRestClient # Create REST client for Cytoscape cy = CyRestClient() # Reset current session for fresh start cy.session.delete() # Load a sample network network = cy.network.create_from('http://chianti.ucsd.edu/~kono/data/galFiltered.sif') # Apply la...
facaiy/book_notes
machine_learning/tree/decision_tree/presentation.ipynb
cc0-1.0
from sklearn.datasets import load_iris data = load_iris() # 准备特征数据 X = pd.DataFrame(data.data, columns=["sepal_length", "sepal_width", "petal_length", "petal_width"]) # 准备标签数据 y = pd.DataFrame(data.target, columns=['target']) y.replace(to_replace=range(3), value=data.target_names, inplace=True) # 组...
kenjisato/intro-macro
doc/python/Optimal Growth (Euler).ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt """ Explanation: Computing the Optimal Grwoth Model by the Euler Equation End of explanation """ alpha = 0.3 delta = 0.05 rho = 0.1 theta = 1 A = 1 def f(x): return A * x**alpha kgrid = np.linspace(0.0, 7.5, 300) fig, ax = plt.subplots(1,1)...
ramseylab/networkscompbio
class06_degdist_python3.ipynb
apache-2.0
import pandas import collections import matplotlib.pyplot as plt import numpy as np import scipy.stats import igraph """ Explanation: CS446/546 - Class Session 6 - Degree Distribution In this class session we are going to plot the degree distribution of the undirected human protein-protein interaction network (PPI), w...
arcyfelix/Courses
18-11-22-Deep-Learning-with-PyTorch/02-Introduction to PyTorch/Part 4 - Fashion-MNIST.ipynb
apache-2.0
import torch from torchvision import datasets, transforms import helper # Define a transform to normalize the data transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))]) # Downl...
Danghor/Formal-Languages
Ply/Conflicts-Resolved.ipynb
gpl-2.0
import ply.lex as lex tokens = [ 'NUMBER' ] def t_NUMBER(t): r'0|[1-9][0-9]*' t.value = float(t.value) return t literals = ['+', '-', '*', '/', '^', '(', ')'] t_ignore = ' \t' def t_newline(t): r'\n+' t.lexer.lineno += t.value.count('\n') def t_error(t): print(f"Illegal character '{t.valu...
jhconning/Dev-II
notebooks/EdgeworthProduction.ipynb
bsd-3-clause
edgeplot(50) """ Explanation: Edgeworth Box: Efficiency in production allocation Efficiency in production Consider a small-open economy with two production sectors -- agriculture and manufacturing -- with production in each sector taking place with constant returns to scale production functions. Producers in the agri...
mne-tools/mne-tools.github.io
0.17/_downloads/fd79fe12dec0d8ba3f96e5d55db03054/plot_ecog.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Chris Holdgraf <choldgraf@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from mayavi import mlab import mne from mne.viz import plot_alignment, snapshot_brain_montage print(__doc__) ""...
SeismicPi/SeismicPi
Lessons/Lesson 5/Lesson 5.ipynb
mit
#find_position here def find_position(a, t, s): return (a-s*t)/2.0; """ Explanation: Lesson 5 In this lesson, we will use the find_position function from the previous lesson to implement a one-dimensional version of piTap. You can tap anywhere along a line and have the program predict where you've tapped! Copy and...
gagneurlab/concise
nbs/effect_prediction.ipynb
mit
from effect_demo_setup import * from concise.models import single_layer_pos_effect as concise_model import numpy as np # Generate training data for the model, use a 1000bp sequence param, X_feat, X_seq, y, id_vec = load_example_data(trim_seq_len = 1000) # Generate the model dc = concise_model(pooling_layer="sum", ...
ajgpitch/qutip-notebooks
examples/spin-chain-model.ipynb
lgpl-3.0
%matplotlib inline from qutip.qip.circuit import QubitCircuit from qutip.qip.operations import gate_sequence_product import numpy as np """ Explanation: QuTiP example: Physical implementation of Spin Chain Qubit model Author: Anubhav Vardhan (anubhavvardhan@gmail.com) Numerical simulation added by Boxi Li (etamin1201...
KiranArun/A-Level_Maths
Integration/Integration.ipynb
mit
import matplotlib.pyplot as plt import numpy as np """ Explanation: Integration End of explanation """ x = np.linspace(-10, 10, 201) def f(x): return x**2 y = f(x) fig, ax = plt.subplots(1, figsize=(8,4)) ax.plot(x,y, 'g', label='line') ax.fill_between(x,y, color='blue', alpha=0.3, label='area under graph')...
phoebe-project/phoebe2-docs
2.1/tutorials/fti.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: Finite Time of Integration (fti) Setup Let's first make sure we have the latest version of PHOEBE 2.1 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 """ %matplo...
BDannowitz/polymath-progression-blog
jlab-ml-lunch-2/notebooks/00-Data-Exploration.ipynb
gpl-2.0
%matplotlib widget import pandas as pd import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d import imageio """ Explanation: JLab ML Lunch 2 - Data Exploration Second ML challenge hosted On October 30th, a test dataset will be released, and predictions must be submitted within 24...
davidwhogg/Avast
notebooks/fakedata2.ipynb
mit
def oned_gaussian(xs, mm, sig): return np.exp(-0.5 * (xs - mm) ** 2 / sig ** 2) / np.sqrt(2. * np.pi * sig) def make_synth(rv, xs, ds, ms, sigs): """ `rv`: radial velocity in m/s (or same units as `c` above `xs`: `[M]` array of wavelength values `ds`: depths at line centers `ms`: locations of t...
CyberCRI/dataanalysis-herocoli-redmetrics
v1.52.2/Tests/2.5 Google form analysis - PCA.ipynb
cc0-1.0
%run "../Functions/2.1 Sampling.ipynb" """ Explanation: Google form analysis tests Purpose: determine in what extent the current data can accurately describe correlations, underlying factors on the score. Especially concerning the answerTemporalities[0] groups: are there underlying groups explaining the discrepancies ...
SealedSaint/CarND-Term1-P1
P1.ipynb
mit
#importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline """ Explanation: Self-Driving Car Engineer Nanodegree Project: Finding Lane Lines on the Road In this project, you will use the tools you learned about in the lesson to ide...
jan-rybizki/Chempy
tutorials/7-Acessing Chempy paper 1 abundance tracks.ipynb
mit
%pylab inline """ Explanation: This notebook will help you to access the chemical abundance tracks that you see in paper 1 figure 17 but for all elements. You can use it to compare it to your own model/data. End of explanation """ # Single zone models for sun, arcturus and cas with default and alternative yield set ...
prashantas/MyDataScience
DeepNetwork/deeplearningai_AndrewNG/Python+Basics+With+Numpy+v3.ipynb
bsd-2-clause
### START CODE HERE ### (≈ 1 line of code) test = 'Hello World' ### END CODE HERE ### print ("test: " + test) """ Explanation: Python Basics with Numpy (optional assignment) Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help fami...
walkon302/CDIPS_Recommender
notebooks/_old/Exploring_Original_Dataset.ipynb
apache-2.0
import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle from IPython.core.debugger import Tracer import seaborn as sns %matplotlib inline """ Explanation: Setup End of explanation """ import tensorflow as tf import sklearn import h5py import keras from keras.preprocessing import image f...
mne-tools/mne-tools.github.io
0.20/_downloads/ad79868fcd6af353ce922b8a3a2fc362/plot_30_info.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_filt-0-40_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file) """ Explanation: The Info data structure This tutori...
tensorflow/cloud
src/python/tensorflow_cloud/core/tests/examples/dogs_classification.ipynb
apache-2.0
!pip install tensorflow-cloud import datetime import os import matplotlib.pyplot as plt import tensorflow as tf import tensorflow_cloud as tfc import tensorflow_datasets as tfds from tensorflow import keras from tensorflow.keras import layers from tensorflow.keras.models import Model """ Explanation: TensorFlow Clo...
geoneill12/phys202-2015-work
assignments/assignment04/MatplotlibExercises.ipynb
mit
%matplotlib inline import matplotlib.pyplot as plt import numpy as np """ Explanation: Visualization 1: Matplotlib Basics Exercises End of explanation """ a = np.random.randn(2,100) x = a[0,:] y = a[1,:] plt.figure(figsize=(5,5)) plt.scatter(x, y, color='green', alpha = 0.9) plt.xlabel('Random Data') plt.ylabel('y(R...
ozorich/phys202-2015-work
assignments/assignment02/ProjectEuler59.ipynb
mit
assert 65 ^ 42 == 107 assert 107 ^ 42 == 65 assert ord('a') == 97 assert chr(97) == 'a' """ Explanation: Project Euler: Problem 59 https://projecteuler.net/problem=59 Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For exa...
jpilgram/phys202-2015-work
assignments/assignment03/NumpyEx03.ipynb
mit
import numpy as np %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import antipackage import github.ellisonbg.misc.vizarray as va """ Explanation: Numpy Exercise 3 Imports End of explanation """ def brownian(maxt, n): """Return one realization of a Brownian (Wiener) process with n steps...
Kidel/In-Codice-Ratio-OCR-with-CNN
Notebooks/03_Mnist-Dataset-Expansion.ipynb
apache-2.0
import os.path from IPython.display import Image from util import Util u = Util() import numpy as np # Explicit random seed for reproducibility np.random.seed(1337) from keras.callbacks import ModelCheckpoint from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from kera...
nick-youngblut/SIPSim
ipynb/theory/non-equilibrium_calcs.ipynb
mit
%load_ext rpy2.ipython %%R library(dplyr) library(tidyr) library(ggplot2) library(gridExtra) %%R GC2MW = function(x){ A = 313.2 T = 304.2 C = 289.2 G = 329.2 GC = G + C AT = A + T x = x / 100 x*GC + (1-x)*AT } GC2BD = function(GC){ # GC = percentage BD = GC / 100 * 0.098...
getsmarter/bda
module_2/M2_NB1_SourcesOfData.ipynb
mit
import pandas as pd from pandas_datareader import data, wb import numpy as np import matplotlib.pylab as plt import matplotlib import folium import geocoder import wikipedia #set plot options %matplotlib inline matplotlib.rcParams['figure.figsize'] = (10, 8) """ Explanation: <div align="right">Python 3.6 Jupyter Note...
empet/Plotly-plots
Spiral-Plot.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np %matplotlib inline PI=np.pi a=2 theta=np.linspace(3*PI/2, 8*PI, 400) z=a*theta*np.exp(-1j*theta) plt.figure(figsize=(6,6)) plt.plot(z.real, z.imag) plt.axis('equal') """ Explanation: Spiral plot Spiral plot is a method of visualizing (periodic) time series. Here we...
pvalienteverde/ElCuadernillo
ElCuadernillo/20160301_TensorFlowGradientDescentWithMomentum/GradientDescentWithMoment.ipynb
mit
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns sns.set(color_codes=True) %matplotlib inline import sys import time from IPython.display import Image sys.path.append('/home/pedro/git/ElCuadernillo/ElCuadernillo/20160301_TensorFlowGradientDescentWithMomentum') import gr...
elenduuche/deep-learning
autoencoder/Simple_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
google-research/google-research
aptamers_mlpd/learning/create_binned_and_super_bin_labels.ipynb
apache-2.0
import pandas as pd import math import numpy as np """ Explanation: Copyright 2021 Google LLC 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 requ...
turbomanage/training-data-analyst
quests/endtoendml/labs/4_preproc.ipynb
apache-2.0
%pip install apache-beam[gcp]==2.13.0 """ Explanation: <h1> Preprocessing using Cloud Dataflow </h1> <h2>Learning Objectives</h2> <ol> <li>Create ML dataset using <a href="https://cloud.google.com/dataflow/">Cloud Dataflow</a></li> <li>Simulate a dataset where no ultrasound is performed (i.e. male or female unkno...
AlpineNow/python-alpine-api
doc/JupyterNotebookExamples/Introduction.ipynb
mit
import alpine as AlpineAPI from pprint import pprint import json """ Explanation: Introduction Let's start with a example of an Alpine API session. Initialize a session. Take a tour of some commands. Run a workflow and download the results. Import the Python Alpine API and some other useful packages. End of explana...
sylvchev/coursIntroPython
cours/5-ApprendrePython-Bibliotheque.ipynb
gpl-3.0
f=open('fichiertravail.txt', 'w') """ Explanation: Fichiers et entrées/sorties Pour écrire ou lire dans un fichier, open() renvoie un objet de type fichier, et est utilisée plus généralement avec deux arguments : open(nomfichier, mode). End of explanation """ f.write('Voici un test\n') """ Explanation: Le premie...
MichaelGrupp/evo
notebooks/pandas_bridge.ipynb
gpl-3.0
# magic plot configuration import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline %matplotlib notebook from IPython.display import display """ Explanation: pandas_bridge The evo.tools.pandas_bridge module converts: * evo.core.trajectory.PosePath3D * evo.core.trajectory.PoseTrajectory3D * evo.core.re...
dnc1994/MachineLearning-UW
ml-classification/module-10-online-learning-assignment-solution.ipynb
mit
from __future__ import division import graphlab """ Explanation: Training Logistic Regression via Stochastic Gradient Ascent The goal of this notebook is to implement a logistic regression classifier using stochastic gradient ascent. You will: Extract features from Amazon product reviews. Convert an SFrame into a Num...
evanmiltenburg/python-for-text-analysis
Chapters-colab/Chapter_03_Strings.ipynb
apache-2.0
%%capture !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Data.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/images.zip !wget https://github.com/cltl/python-for-text-analysis/raw/master/zips/Extra_Material.zip !unzip Data.zip -d ../ !unzip images.zip -d ./ !unzip Ext...
google/starthinker
colabs/anonymize.ipynb
apache-2.0
!pip install git+https://github.com/google/starthinker """ Explanation: BigQuery Anonymize Dataset Copies tables and view from one dataset to another and anynonamizes all rows. Used to create sample datasets for dashboards. License Copyright 2020 Google LLC, Licensed under the Apache License, Version 2.0 (the "Licen...
stephank16/enes_graph_use_case
prov_templates/Data_ingest_use_case_templates.ipynb
gpl-3.0
# import variable setting dictionaries from dkrz data ingest tool chain # and remove __doc__ strings from dictionary (would clutter PROV graph visualizations) from provtemplates import workflow_steps from collections import MutableMapping from contextlib import suppress def delete_keys_from_dict(dictionary, keys): ...
blue-yonder/tsfresh
notebooks/examples/02 sklearn Pipeline.ipynb
mit
import pandas as pd from sklearn.pipeline import Pipeline from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import classification_report from tsfresh.examples import load_robot_execution_failures from tsfresh.transformers import RelevantFeatur...
sysid/nbs
lstm/SequenceClassification_LSTM_CNN.ipynb
mit
import numpy from keras.datasets import imdb from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.layers.embeddings import Embedding from keras.preprocessing import sequence # fix random seed for reproducibility numpy.random.seed(7) # load the dataset but only kee...
statsmodels/statsmodels.github.io
v0.13.2/examples/notebooks/generated/generic_mle.ipynb
bsd-3-clause
import numpy as np from scipy import stats import statsmodels.api as sm from statsmodels.base.model import GenericLikelihoodModel """ Explanation: Maximum Likelihood Estimation (Generic models) This tutorial explains how to quickly implement new maximum likelihood models in statsmodels. We give two examples: Probit ...
JoseGuzman/myIPythonNotebooks
pub/Migration velocity.ipynb
gpl-2.0
%pylab inline import pandas as pd # read CSV file in pandas mydf = pd.read_csv('.data/Julie_R1_Bef_S4_cell123_Position.csv', skiprows=2) mydf.head() """ Explanation: <H1>Migration velocity</H1> <P> To compute the velocity of the trajectories of several particles, we generated a file with the 3D coordinates (Position...
google/jax
docs/notebooks/vmapped_log_probs.ipynb
apache-2.0
import functools import itertools import re import sys import time from matplotlib.pyplot import * import jax from jax import lax import jax.numpy as jnp import jax.scipy as jsp from jax import random import numpy as np import scipy as sp """ Explanation: Autobatching log-densities example This notebook demonstra...