repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
bchappet/dnfpy
Rapport/Rapport.ipynb
gpl-2.0
x = np.array([1, 2, 3, 4, 5, 6]) ir = np.array([0.000000000000000000e+00, 0.000000000000000000e+00, 6.056077528688350031e-03, 8.428876313973869550e-03, 0.000000000000000000e+00, 0.000000000000000000e+00]) ir=ir*100 dnf = np.array([-1.090321063995361328e+00, -6.263688206672668457e-01, 2.505307266418066447e-03, 1.3928876...
tpin3694/tpin3694.github.io
machine-learning/feature_importance.ipynb
mit
# Load libraries from sklearn.ensemble import RandomForestClassifier from sklearn import datasets import numpy as np import matplotlib.pyplot as plt """ Explanation: Title: Feature Importance Slug: feature_importance Summary: How to identify important features in random forest in scikit-learn. Date: 2017-09-21 12:00 C...
awadalaa/DataSciencePractice
kaggle/titanic/TitanicPrediction.ipynb
mit
import csv as csv import numpy as np import pandas as pd # We can use the pandas library in python to read in the csv file. # This creates a pandas dataframe and assigns it to the titanic variable. titanic = pd.read_csv("data/train.csv") # Print the first 5 rows of the dataframe. print(titanic.head(5)) print(titanic...
landlab/landlab
notebooks/tutorials/tidal_flow/tidal_flow_calculator.ipynb
mit
# imports import numpy as np import matplotlib.pyplot as plt from landlab import RasterModelGrid, imshow_grid from landlab.components import TidalFlowCalculator # set up the grid grid = RasterModelGrid( (3, 101), xy_spacing=2.0 ) # only 1 row of core nodes, between 2 boundary rows grid.set_closed_boundaries_at_gr...
jo-c-2017/DS_Projects
JC_inferential_statistics_ex1.ipynb
apache-2.0
import pandas as pd df = pd.read_csv('data/human_body_temperature.csv') df.head() """ Explanation: What is the True Normal Human Body Temperature? Background The mean normal body temperature was held to be 37$^{\circ}$C or 98.6$^{\circ}$F for more than 120 years since it was first conceptualized and reported by Carl ...
ampl/amplpy
notebooks/hashcode/practice_problem.ipynb
bsd-3-clause
import os if not os.path.isdir('input_data'): os.system('git clone https://github.com/ampl/amplpy.git') os.chdir('amplpy/notebooks/hashcode') if not os.path.isdir('ampl_input'): os.mkdir('ampl_input') """ Explanation: Google Hashcode 2022 Google Hashcode is a team programming competition to solve a complex...
robblack007/clase-metodos-numericos
Practicas/P1/.ipynb_checkpoints/Practica 1 - Introduccion a Jupyter-checkpoint.ipynb
mit
2 + 3 2*3 2**3 sin(pi) """ Explanation: Introducción a Jupyter Expresiones aritmeticas y algebraicas Empezaremos esta práctica con algo de conocimientos previos de programación. Se que muchos de ustedes no han tenido la oportunidad de utilizar Python como lenguaje de programación y mucho menos Jupyter como ambiente...
skkandrach/foundations-homework
.ipynb_checkpoints/Homework6_Soma-checkpoint.ipynb
mit
#api KEY = c9d64e80aa02ca113562a075e57256d7 https://api.forecast.io/forecast/c9d64e80aa02ca113562a075e57256d7/10.4806,66.9036 import requests response = requests.get("https://api.forecast.io/forecast/c9d64e80aa02ca113562a075e57256d7/10.4806,66.9036") forecast = response.json() print(forecast.keys()) print(forecast...
jbwhit/WSP-312-Tips-and-Tricks
notebooks/autoreload-example.ipynb
mit
import os import sys import time sys.path.append("..") %reload_ext autoreload """ Explanation: How to use autoreload I have been confused on how to use autoreload IPython extension for a long time. The documentation simply wasn't clear to me. Or, rather, it seemed clear, but then I was surprised by the behavior. After...
bgruening/EDeN
examples/classification.ipynb
gpl-3.0
from eden.util import load_target y = load_target( 'http://www.bioinf.uni-freiburg.de/~costa/bursi.target' ) """ Explanation: Classification Consider a binary classification problem. The data and target files are available online. The domain of the problem is chemoinformatics. Data is about toxicity of 4K small molecu...
nikodtbVf/aima-si
csp.ipynb
mit
from csp import * """ Explanation: Constraint Satisfaction Problems (CSPs) This IPy notebook acts as supporting material for topics covered in Chapter 6 Constraint Satisfaction Problems of the book Artificial Intelligence: A Modern Approach. We make use of the implementations in csp.py module. Even though this noteboo...
rubensfernando/mba-analytics-big-data
Python/2016-07-29/aula4-parte2-recuperar-tweets.ipynb
mit
import tweepy consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '' """ Explanation: Recuperando Tweets Para utilizar qualquer API do Twitter temos que importar os módulos e definir as chaves e tokens de acesso. End of explanation """ autorizar = tweepy.OAuthHandler(consumer_key, consume...
mne-tools/mne-tools.github.io
stable/_downloads/c6baf7c1a2f53fda44e93271b91f45b8/50_beamformer_lcmv.ipynb
bsd-3-clause
# Authors: Britta Westner <britta.wstnr@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD-3-Clause import matplotlib.pyplot as plt import mne from mne.datasets import sample, fetch_fsaverage from mne.beamformer import make_lcmv, apply_lcmv """ Explanation: Source reconstruction using an LCM...
samkennerly/fridge
cache_output.ipynb
bsd-3-clause
import datetime as dt import time import fridge """ Explanation: Test CacheOutput() class-based function decorator End of explanation """ # This decorator just displays how long a function takes to run def showtime(func): def wrapper(*args,**kwargs): start = dt.datetime.now() result = func(*a...
CoreSecurity/pysap
docs/protocols/SAPEnqueue.ipynb
gpl-2.0
from pysap.SAPEnqueue import * from IPython.display import display """ Explanation: SAP Enqueue The following subsections show a graphical representation of the main protocol packets and how to generate them. First we need to perform some setup to import the packet classes: End of explanation """ for dest in enqueue...
ML4DS/ML4all
P1.Python_intro/P1_Starting_with_Python_student.ipynb
mit
a = 'house' print(a) """ Explanation: A Brief Tutorial of Basic Python Author: Jesús Fernández Bes Jerónimo Arenas García (jeronimo.arenas@uc3m.es) Jesús Cid Sueiro (jcid@tsc.uc3m.es) Vanessa Gómez Verdejo (vanessa@tsc.uc3m.es) Óscar García Hinde (oghinnde@tsc.uc3m.es) Simón Roc...
mediagit2016/workcamp-maschinelles-lernen-grundlagen
17-12-11-workcamp-ml/2017-12-11-arbeiten-mit-numpy-10.ipynb
gpl-3.0
import numpy as np x = np.array([1,2,3,4,5]) #Ausgabe des Arrays, des Speicherortes und der Länge des arrays print(x,id(x),len(x)) """ Explanation: <h1>Arbeiten mit numpy</h1> <h2>Erzeugen eines numpy array</h2> <h2>1. Beispiel</h2> End of explanation """ y = np.array([6,8,3,2,5,4,7,6]) print(y) print(len(y)) print...
quantumlib/Cirq
examples/direct_fidelity_estimation.ipynb
apache-2.0
try: import cirq except ImportError: print("installing cirq...") !pip install --quiet cirq print("installed cirq.") # Import Cirq, DFE, and create a circuit import cirq from cirq.contrib.svg import SVGCircuit import examples.direct_fidelity_estimation as dfe qubits = cirq.LineQubit.range(3) circuit = ...
DominikDitoIvosevic/Uni
STRUCE/SU-2019-LAB02-LDM-LR.ipynb
mit
# Učitaj osnovne biblioteke... import numpy as np import sklearn import mlutils import matplotlib.pyplot as plt %pylab inline """ Explanation: Sveučilište u Zagrebu Fakultet elektrotehnike i računarstva Strojno učenje 2019/2020 http://www.fer.unizg.hr/predmet/su Laboratorijska vježba 2: Linearni diskriminativni mod...
SHDShim/pytheos
examples/10_pvt-eos_fit.ipynb
apache-2.0
%config InlineBackend.figure_format = 'retina' """ Explanation: For high dpi displays. End of explanation """ import numpy as np import uncertainties as uct import pandas as pd from uncertainties import unumpy as unp import matplotlib.pyplot as plt import pytheos as eos """ Explanation: 0. General note This noteb...
ryan-leung/PHYS4650_Python_Tutorial
notebooks/Jan2018/pre_tutorial/CH2 Data Structures and Loops.ipynb
bsd-3-clause
(1, 'HKU', 3.0) """ Explanation: Ch2 Data Structures In this part you will learn how to define data structure more than integer, tuples and boolean. Tuple Tuple in python is an 1D array that cannot change its content after declariation. The tuple can store differently type of elements. It is defined with parentheses. ...
statsmodels/statsmodels.github.io
v0.12.2/examples/notebooks/generated/statespace_cycles.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 pandas_datareader.data import DataReader endog = DataReader('UNRATE', 'fred', start='1954-01-01') endog.index.freq = endog.index.inferred_freq """ Explanation: Trends and cycles in unemployment...
tuanavu/python-cookbook-3rd
notebooks/ch01/01_unpacking_a_sequence_into_variables.ipynb
mit
# Example 1 p = (4, 5) x, y = p print x print y """ Explanation: Unpacking a Sequence into Separate Variables Problem You have an N-element tuple or sequence that you would like to unpack into a collection of N variables. Solution Any sequence (or iterable) can be unpacked into variables using a simple assignment op...
khalido/nd101
mnist_keras_simple.ipynb
gpl-3.0
from keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() """ Explanation: Keras is a high level wrapper (API) for Tensorflow and Theano which aims to make them easier to use. Tensorflow gets quite verbose and there is a lot of detail to handle, which Keras trys to abstract away to sane...
Chilipp/psy-simple
examples/example_plot2d.ipynb
gpl-2.0
import psyplot.project as psy import xarray as xr %matplotlib inline %config InlineBackend.close_figures = False import numpy as np """ Explanation: 2D plots Demonstration of the 2D plot capabilities The plot2d plot method make plots of 2-dimensional scalar data using matplotlibs pcolormesh or the contourf functions. ...
michaelneuder/image_quality_analysis
bin/calculations/ssim/SSIM.ipynb
mit
import matplotlib.pyplot as plt import pandas as pd import numpy as np from scipy import stats from PIL import Image as im %matplotlib inline plt.rcParams['font.size'] = 20 """ Explanation: ssim data this notebook explores the data and makes sure everything looks correct. End of explanation """ # take a peek at the ...
prody/ProDy-website
_static/ipynb/MechStiff_tutorial.ipynb
mit
%matplotlib inline from prody import * import matplotlib.pylab as plt gfp, header = parsePDB('1gfl', header=True) gfp calphas = gfp.select('protein and chain A and name CA') calphas """ Explanation: MechStiff tutorial This is an example how to use Mechanical Stiffness Calculations implemented in ProDy package. The...
catalystcomputing/DSIoT-Python-sessions
Session5/code/09 Pandas - Part 2.ipynb
apache-2.0
import pandas as pd df_temp = pd.read_csv('../data/airquality.csv', usecols = ["Ozone", "Solar.R", "Wind", "Temp", "Month", "Day"]) # We exclude the first column (= index) because we don't need it. # To do that, just specify the columns of interest in usecols #Let's add a year column df_temp["Y...
mturnbu/datascience
Thanksgiving-Dinner/Thanksgiving-Dinner.ipynb
mit
import pandas as pd data = pd.read_csv("thanksgiving.csv", encoding = 'Latin-1') data.head() data.columns data['Do you celebrate Thanksgiving?'].value_counts() """ Explanation: Analyzing Thanksgiving Dinner This notebook analyzes Thanksgiving dinner in the US. The dataset contains 1058 responses to an online survey...
mauriciogtec/PropedeuticoDataScience2017
Alumnos/Arturo_Gonzalez/Tarea2-ArturoGonzalezBencomo.ipynb
mit
from PIL import Image import matplotlib.pyplot as plt import numpy as np #url = sys.argv[1] url = 'Mario.png' img = Image.open(url) imggray = img.convert('LA') """ Explanation: Parte 1: Teoría de Algebra Lineal y Optimización 1. ¿Por qué una matriz equivale a una transformación lineal entre espacios vectoriales?<b...
jhconning/Dev-II
notebooks/moralhazard.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from ipywidgets import interact, fixed """ Explanation: Risk Sharing and Moral Hazard End of explanation """ alpha = 0.25 def u(c, alpha=alpha): return (1/alpha)*c**alpha def E(x,p): return p*x[1] + (1-p)*x[0] def EU(c, p): return p...
sorig/shogun
doc/ipython-notebooks/computer_vision/Scene_classification.ipynb
bsd-3-clause
#import Opencv library import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') try: import cv2 except ImportError: print "You must have OpenCV installed" exit(1) #check the OpenCV version try: v=cv2.__version__ assert (tuple(map(int,v.split(".")))>(2,4,2)) except (AssertionError, Va...
kimegitee/deep-learning
language-translation/dlnd_language_translation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper import problem_unittests as tests source_path = 'data/small_vocab_en' target_path = 'data/small_vocab_fr' source_text = helper.load_data(source_path) target_text = helper.load_data(target_path) """ Explanation: Language Translation In this project, you’re going...
diegocavalca/Studies
programming/Python/tensorflow/exercises/Control_Flow.ipynb
cc0-1.0
from __future__ import print_function import tensorflow as tf import numpy as np from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises" tf.__version__ np.__version__ sess = tf.InteractiveSession() """ Explanation: Control Flow End of explanation """ x = tf.c...
Islast/BrainNetworksInPython
tutorials/global_measures_viz.ipynb
mit
import scona as scn import scona.datasets as datasets import numpy as np import networkx as nx import pandas as pd from IPython.display import display import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline %load_ext autoreload %autoreload 2 """ Explanation: Visualisation tutorial In the introductor...
NeuroDataDesign/seelviz
Jupyter/ClarityViz Tutorial.ipynb
apache-2.0
from clarityviz import claritybase token = 'Fear199' source_directory = '/cis/home/alee/claritycontrol/code/data/raw' # Initialize the claritybase object, the initial basis for all operations. # After you initialize with a token and source directory, a folder will be created in your current directory # with the token...
ruleva1983/udacity-mle
exploratory_project/Titanic_Survival_Exploration.ipynb
gpl-3.0
import numpy as np import pandas as pd # RMS Titanic data visualization code from titanic_visualizations import survival_stats from IPython.display import display %matplotlib inline # Load the dataset in_file = 'titanic_data.csv' full_data = pd.read_csv(in_file) # Print the first few entries of the RMS Titanic dat...
PyladiesMx/Empezando-con-Python
2. Lists_and_conditionals/.ipynb_checkpoints/lists and conditionals-checkpoint.ipynb
mit
lista1 = ["Hola", 1, 2.0, True] lista1 lista2 = [2+3, 5+1, 4**2] lista2 """ Explanation: ¡Bienvenidas nuevamente! Hoy veremos otro tipo de objetos en python llamados listas y además empezaremos a tomar decisiones con expresiones condicionales. ¿Y qué pasa si queremos coleccionar valores? Acerca de las listas... En ...
AlphaGit/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...
tuanavu/coursera-university-of-washington
machine_learning/2_regression/lecture/week4/Overfitting_Demo_Ridge_Lasso.ipynb
mit
import sys sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages') import graphlab import math import random import numpy from matplotlib import pyplot as plt %matplotlib inline """ Explanation: Overfitting demo Create a dataset based on a true sinusoidal relationship Let's look at a synthetic dataset consisti...
csaladenes/aviation
code/.ipynb_checkpoints/airport_arrv_parser_old-checkpoint.ipynb
mit
L=json.loads(file('../json/L.json','r').read()) M=json.loads(file('../json/M.json','r').read()) N=json.loads(file('../json/N.json','r').read()) import requests AP={} for c in M: if c not in AP:AP[c]={} for i in range(len(L[c])): AP[c][N[c][i]]=L[c][i] sch={} """ Explanation: Load airports of each co...
adityaka/misc_scripts
python-scripts/data_analytics_learn/link_pandas/Ex_Files_Pandas_Data/Exercise Files/05_03/Begin/Multiple.ipynb
bsd-3-clause
import pandas as pd import numpy as np import matplotlib.pyplot as plt plt.style.use('ggplot') """ Explanation: <h1>Multiples Lines, Single Plot</h1> End of explanation """ data_set_size = 15 low_mu, low_sigma = 50, 4.3 low_data_set = low_mu + low_sigma * np.random.randn(data_set_size) high_mu, high_sigma = 57, 5.2 ...
AtmaMani/pyChakras
udemy_ml_bootcamp/Machine Learning Sections/Decision-Trees-and-Random-Forests/Decision Trees and Random Forest Project - Solutions.ipynb
mit
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Random Forest Project - Solutions For this project we will be exploring publicly available data from Lending...
deculler/DataScienceTableDemos
BerkeleySalary.ipynb
bsd-2-clause
# This useful nonsense just goes at the top from datascience import * import numpy as np import matplotlib.pyplot as plots plots.style.use('fivethirtyeight') %matplotlib inline # datascience version number of last run of this notebook version.__version__ """ Explanation: Illustration of datascience Tables on Open Data...
lia-statsletters/notebooks
Copula Packages Notebook.ipynb
gpl-3.0
#The first assert makes sure that you are getting a 1D in X and Y #replace this code around line 58 in site-packages/copulalib/copulalib.py try: if X.shape[0] != Y.shape[0]: raise ValueError('The size of both arrays should be same.') except: raise ...
tensorflow/docs-l10n
site/ja/addons/tutorials/tqdm_progress_bar.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...
sdss/marvin
docs/sphinx/tutorials/notebooks/VAC_MVM_Marvin_tutorial.ipynb
bsd-3-clause
import marvin from marvin.tools import Cube from marvin.tools import Maps from marvin.tools.vacs import VACs """ Explanation: MaNGA Visual Morphology Catalogue (MVM-VAC) Credit: Jose Antonio Vazquez Mata See SDSS DR16 MVM for more information about this VAC. This catalogue contains a direct visual morphological classi...
alberto-antonietti/nest-simulator
doc/model_details/noise_generator.ipynb
gpl-2.0
import sympy sympy.init_printing() x = sympy.Symbol('x') sympy.series((1-sympy.exp(-x))/(1+sympy.exp(-x)), x) """ Explanation: The NEST noise_generator Hans Ekkehard Plesser, 2015-06-25 This notebook describes how the NEST noise_generator model works and what effect it has on model neurons. NEST needs to be in your PY...
ivukotic/ML_platform_tests
tutorial/DeepLearningImages/DeepLearning-MNIST.ipynb
gpl-3.0
# Function to import the dataset # (if 'do_handwritten_digit_mnist = True' the standard handwritten digit MNIST dataset will be used instead of the fashion dataset) import h5py def import_data(do_handwritten_digit_mnist = False): # Load the data from hdf5 files if do_handwritten_digit_mnist: h5_fi...
harishkrao/DSE200x
Week-3-Numpy/03_Numpy_Notebook.ipynb
mit
import numpy as np an_array = np.array([3, 33, 333]) # Create a rank 1 array print(type(an_array)) # The type of an ndarray is: "<class 'numpy.ndarray'>" # test the shape of the array we just created, it should have just one dimension (Rank 1) print(an_array.shape) # because this is a 1-rank array, we...
cgivre/oreilly-sec-ds-fundamentals
Notebooks/Intro/Two Dimensional Data Worksheet - Python Answers.ipynb
apache-2.0
%pylab inline import pandas as pd import numpy as np pd.options.mode.chained_assignment = None #Create a dataframe called twitter data from the CSV file #Note if this is breaking your machine there is a smaller data set in the data file called twitter1-small.csv twitterData = pd.read_csv( '../../data/twitter1.csv', en...
arsenovic/clifford
docs/tutorials/cga/robotic-manipulators.ipynb
bsd-3-clause
class AddMethodsAsWeGo: @classmethod def _add_method(cls, m): if isinstance(m, property): name = (m.fget or m.fset).__name__ else: name = m.__name__ setattr(cls, name, m) """ Explanation: This notebook is part of the clifford documentation: https://clifford.readt...
astroumd/GradMap
notebooks/Haiti2016/orbits.ipynb
gpl-3.0
%matplotlib inline # python 2-3 compatibility from __future__ import print_function """ Explanation: Gas Streaming in Disks: orbit approach The gas streaming around a young star, or in a galactic disk is dominated by gravity. So we can simply compute the orbits of a point mass around a star, or in the more complex po...
joshspeagle/dynesty
demos/Examples -- 200-D Multivariate Normal.ipynb
mit
# system functions that are always useful to have import time, sys, os import pickle # basic numeric setup import numpy as np from numpy import linalg from scipy import stats # inline plotting %matplotlib inline # plotting import matplotlib from matplotlib import pyplot as plt # seed the random number generator rst...
SHDShim/pytheos
examples/4_calculate_thermal_terms.ipynb
apache-2.0
%config InlineBackend.figure_format = 'retina' """ Explanation: For high dpi displays. End of explanation """ import uncertainties as uct import numpy as np from uncertainties import unumpy as unp import matplotlib.pyplot as plt import pytheos as eos """ Explanation: 0. General note There exist different formulati...
rashikaranpuria/Machine-Learning-Specialization
Clustering_&_Retrieval/Week5/5_lda_blank.ipynb
mit
import graphlab as gl import numpy as np import matplotlib.pyplot as plt %matplotlib inline # import wiki data wiki = gl.SFrame('people_wiki.gl/') wiki """ Explanation: Latent Dirichlet Allocation for Text Data In this assignment you will apply standard preprocessing techniques on Wikipedia text data use GraphLab ...
awhite40/pymks
notebooks/cahn_hilliard.ipynb
mit
%matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt """ Explanation: Cahn-Hilliard Example This example demonstrates how to use PyMKS to solve the Cahn-Hilliard equation. The first section provides some background information about the Cahn-Hilliard equation as we...
oscarmore2/deep-learning-study
tv-script-generation/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
exowanderer/ExoplanetTSO
Exoplanet_TSO_Pipeline_Median.ipynb
gpl-3.0
from wanderer import wanderer def clipOutlier2D(arr2D, nSig=10): arr2D = arr2D.copy() medArr2D = median(arr2D,axis=0) sclArr2D = np.sqrt(((scale.mad(arr2D)**2.).sum())) outliers = abs(arr2D - medArr2D) > nSig*sclArr2D inliers = abs(arr2D - medArr2D) <= nSig*sclArr2D arr2D[outliers] = ...
NeuroDataDesign/pan-synapse
pipeline_1/background/Net_Registration.ipynb
apache-2.0
def knn_filter(volume, n): #neighborList = [] outVolume = np.zeros_like(volume) #for all voxels in volume for z in range(volume.shape[0]): for y in range(volume.shape[1]): for x in range(volume.shape[2]): #get all valid neighbors neighbors = [] ...
jasonding1354/PRML_Notes
2.LINEAR_MODELS_FOR_REGRESSION/Old_Faithful_Geyser_Experiment.ipynb
mit
import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline faithfulData = pd.read_csv("faithful.csv", index_col=0, dtype=np.float64) faithfulData.head() waiting = faithfulData['waiting'] eruptions = faithfulData['eruptions'] fig = plt.figure(figsize=(8,8)) ax = fig.add_subplot() plt.p...
cgpotts/cs224u
vsm_04_contextualreps.ipynb
apache-2.0
__author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Spring 2022" """ Explanation: Vector-space models: Static representations from contextual models End of explanation """ import os import pandas as pd import torch from transformers import BertModel, BertTokenizer from transformers import RobertaModel,...
andrebell/winproxy
winproxy/__init__.ipynb
bsd-2-clause
import re, six from six.moves import winreg """ Explanation: Python 2.7 compatibility To achieve Python 2.7 compatibility we will import the "_winreg" module from six.moves, since it has been renamed to winreg in Python 3. End of explanation """ if six.PY2: FileNotFoundError = WindowsError """ Explanation: The ...
TariqAHassan/BioVida
tutorials/3_domain_unification_and_data_management.ipynb
bsd-3-clause
from biovida.images import OpeniInterface opi = OpeniInterface() opi.search(query='lung cancer') pull_df1 = opi.pull() """ Explanation: BioVida: Domain Unification and Data Management This tutorial will cover the facilities BioVida offers to: integrate images data against other kinds of biomedical data manage cac...
ivannz/study_notes
year_14_15/spring_2015/netwrok_analysis/notebooks/assignments/networks_ha2.ipynb
mit
## As usual, attach the numpy and the netwrokx modules import networkx as nx import numpy as np import numpy.random as rnd import numpy.matlib as ml from scipy.stats import chisquare import matplotlib.pyplot as plt %matplotlib inline ## Use direct HTML output capabilities of iPython from IPython.display import HTML ...
nickgorgone/AstroHackWeek2015
Parallel-Profile.ipynb
gpl-2.0
import multiprocessing as mp import time import numpy as np npoints = 5 input_arr = np.random.rand(npoints) nproc=int(np.floor(npoints/2.)) def makedistance(i): output_arr = i**i return output_arr t1 = time.time() pool = mp.Pool(processes=nproc) out = pool.map(makedistance, input_arr) pool.close() pool.joi...
mne-tools/mne-tools.github.io
0.22/_downloads/03c9d71de135994dbf45db72856a1f9a/plot_mne_inverse_envelope_correlation.ipynb
bsd-3-clause
# Authors: Eric Larson <larson.eric.d@gmail.com> # Sheraz Khan <sheraz@khansheraz.com> # Denis Engemann <denis.engemann@gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.connectivity import envelope_correlation from mn...
brandoncgay/deep-learning
dcgan-svhn/DCGAN_Exercises.ipynb
mit
%matplotlib inline import pickle as pkl import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat import tensorflow as tf !mkdir data """ Explanation: Deep Convolutional GANs In this notebook, you'll build a GAN using convolutional layers in the generator and discriminator. This is called a De...
CORE-GATECH-GROUP/serpent-tools
examples/XSPlot.ipynb
mit
import os xfile = os.path.join( os.environ["SERPENT_TOOLS_DATA"], "plut_xs0.m") """ Explanation: Copyright (c) 2017-2020 Serpent-Tools developer team, GTRC THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS...
richlewis42/scikit-chem
docs/tutorial/io.ipynb
bsd-3-clause
df = pd.read_csv('https://archive.org/download/scikit-chem_example_files/iris.csv', header=None); df """ Explanation: Input/Output Pandas objects are the main data structures used for collections of molecules. scikit-chem provides convenience functions to load objects into pandas.DataFrames from comm...
gte620v/PythonTutorialWithJupyter
examples/2017-03-05-Graph_Entity_Resolution.ipynb
mit
import pandas as pd df = pd.read_csv( 'https://github.com/gte620v/graph_entity_resolution/raw/master/data/scraped_data.csv.gz', converters={'name': lambda x: str(x).lower(), 'number': str, 'oid': str, 'post_id': str}, parse_dates=['postdate'], compression=...
squishbug/DataScienceProgramming
DataScienceProgramming/04-Pandas-Data-Tables/PandasExercise_solution.ipynb
cc0-1.0
import pandas as pd import numpy as np %%time Employees = pd.read_excel('/home/data/AdventureWorks/Employees.xls') print("shape:", Employees.shape) %%time Territory = pd.read_excel('/home/data/AdventureWorks/SalesTerritory.xls') print("shape:", Territory.shape) %%time Customers = pd.read_excel('/home/data/AdventureW...
xdnian/pyml
assignments/ex05_ch0607_xdnian.ipynb
mit
# Added version check for recent scikit-learn 0.18 checks from distutils.version import LooseVersion as Version from sklearn import __version__ as sklearn_version """ Explanation: Assignment 5 This assignment has weighting $1.5$. Author: Nian Xiaodong (3035087112) Model tuning and evaluation End of explanation """ i...
M-R-Houghton/euroscipy_2015
scikit_image/lectures/stackoverflow_challenges.ipynb
mit
from scipy.signal import convolve2d img = color.rgb2gray(io.imread('../images/snakes.png')) # Reduce all lines to one pixel thickness snakes = morphology.skeletonize(img < 1) # Find pixels with only one neighbor corners = convolve2d(snakes, [[1, 1, 1], [1, 0, 1], ...
asurve/arvind-sysml2
samples/jupyter-notebooks/.ipynb_checkpoints/Linear_Regression_Algorithms_Demo-checkpoint.ipynb
apache-2.0
!pip show systemml """ Explanation: Linear Regression Algorithms using Apache SystemML This notebook shows: - Install SystemML Python package and jar file - pip - SystemML 'Hello World' - Example 1: Matrix Multiplication - SystemML script to generate a random matrix, perform matrix multiplication, and compute th...
geektoni/shogun
doc/ipython-notebooks/converter/Tapkee.ipynb
bsd-3-clause
import numpy as np import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') def generate_data(curve_type, num_points=1000): if curve_type=='swissroll': tt = np.array((3*np.pi/2)*(1+2*np.random.rand(num_points))) height = np.array((np.random.rand(num_points)-0.5)) X = np.array([tt*np.cos(tt), 10*h...
biof-309-python/BIOF309-2016-Fall
Week_06/Week06 - 01 - Homework Solutions.ipynb
mit
# %load data.csv Drosophila melanogaster,atatatatatcgcgtatatatacgactatatgcattaattatagcatatcgatatatatatcgatattatatcgcattatacgcgcgtaattatatcgcgtaattacga,kdy647,264 Drosophila melanogaster,actgtgacgtgtactgtacgactatcgatacgtagtactgatcgctactgtaatgcatccatgctgacgtatctaagt,jdg766,185 Drosophila simulans,atcgatcatgtcgatcgatgatgc...
Ccaccia73/semimonocoque
03_Multiconnected_section.ipynb
mit
from pint import UnitRegistry import sympy import networkx as nx import numpy as np import matplotlib.pyplot as plt import sys %matplotlib inline from IPython.display import display """ Explanation: Semi-Monocoque Theory End of explanation """ from Section import Section """ Explanation: Import Section class, which...
tensorflow/probability
tensorflow_probability/examples/jupyter_notebooks/TensorFlow_Probability_on_JAX.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...
ES-DOC/esdoc-jupyterhub
notebooks/miroc/cmip6/models/miroc6/seaice.ipynb
gpl-3.0
# DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'miroc6', 'seaice') """ Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: MIROC Source ID: MIROC6 Topic: Seaice Sub-Topics: Dynamics, Thermodynamics, Radiativ...
mne-tools/mne-tools.github.io
0.16/_downloads/plot_left_cerebellum_volume_source.ipynb
bsd-3-clause
# Author: Alan Leggitt <alan.leggitt@ucsf.edu> # # License: BSD (3-clause) import numpy as np from scipy.spatial import ConvexHull from mayavi import mlab from mne import setup_source_space, setup_volume_source_space from mne.datasets import sample print(__doc__) data_path = sample.data_path() subjects_dir = data_pa...
NicWayand/xray
examples/xarray_multidimensional_coords.ipynb
apache-2.0
%matplotlib inline import numpy as np import pandas as pd import xarray as xr import cartopy.crs as ccrs from matplotlib import pyplot as plt print("numpy version : ", np.__version__) print("pandas version : ", pd.__version__) print("xarray version : ", xr.version.version) """ Explanation: Working with Multidimens...
MegaShow/college-programming
Homework/Principles of Artificial Neural Networks/Week 17 Robustness/Robustness.ipynb
mit
%matplotlib inline %load_ext autoreload %autoreload 2 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets, transforms import resnet import numpy as np import matplotlib.pyplot as plt # start """ Explanation: Week 16. Robustness Deep learn...
google/jax
cloud_tpu_colabs/JAX_demo.ipynb
apache-2.0
import jax.tools.colab_tpu jax.tools.colab_tpu.setup_tpu() """ Explanation: Colab JAX TPU Setup End of explanation """ import jax import jax.numpy as jnp from jax import random key = random.PRNGKey(0) key, subkey = random.split(key) x = random.normal(key, (5000, 5000)) print(x.shape) print(x.dtype) y = jnp.dot(x...
woobe/odsc_h2o_machine_learning
py_03a_regression_basics.ipynb
apache-2.0
# Start and connect to a local H2O cluster import h2o h2o.init(nthreads = -1) """ Explanation: Machine Learning with H2O - Tutorial 3a: Regression Models (Basics) <hr> Objective: This tutorial explains how to build regression models with four different H2O algorithms. <hr> Wine Quality Dataset: Source: https://ar...
smorton2/think-stats
code/chap11soln.ipynb
gpl-3.0
from __future__ import print_function, division %matplotlib inline import numpy as np import pandas as pd import random import thinkstats2 import thinkplot """ Explanation: Examples and Exercises from Think Stats, 2nd Edition http://thinkstats2.com Copyright 2016 Allen B. Downey MIT License: https://opensource.org...
Sasanita/nmt-keras
examples/4_nmt_model_tutorial.ipynb
mit
from keras.layers import * from keras.models import model_from_json, Model from keras.optimizers import Adam, RMSprop, Nadam, Adadelta, SGD, Adagrad, Adamax from keras.regularizers import l2 from keras_wrapper.cnn_model import Model_Wrapper from keras_wrapper.extra.regularize import Regularize """ Explanation: NMT-Ker...
m2dsupsdlclass/lectures-labs
labs/09_triplet_loss/triplet_loss_totally_looks_like.ipynb
mit
import os import os.path as op from urllib.request import urlretrieve from pathlib import Path URL = "https://github.com/m2dsupsdlclass/lectures-labs/releases/download/totallylookslike/dataset_totally.zip" FILENAME = "dataset_totally.zip" if not op.exists(FILENAME): print('Downloading %s to %s...' % (URL, FILENAM...
fullmetalfelix/ML-CSC-tutorial
GeneticAlgorithm.ipynb
gpl-3.0
# IMPORTS import os import math import random import numpy from GA import GAEngine import matplotlib.pyplot as plt """ Explanation: Genetic Algorithm GA is a simple optimisation algorithm that mimics evolution. It starts with a random population of elements, and evaluates how <i>fit for survival</i> they are. Elements...
KaiSzuttor/espresso
doc/tutorials/12-constant_pH/12-constant_pH.ipynb
gpl-3.0
import matplotlib.pyplot as plt import numpy as np import scipy.constants # physical constants import espressomd import pint # module for working with units and dimensions from espressomd import electrostatics, polymer, reaction_ensemble from espressomd.interactions import HarmonicBond ureg = pint.UnitRegistry() # ...
tensorflow/docs
site/en/guide/migrate/upgrade.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...
eriksalt/jupyter
Python Quick Reference/Metaprogramming.ipynb
mit
def hello_world(): print('hello world') # wrap hello world in a function that does logging def wrap_hello(): print('Enter: hello_world') hello_world() print('Exit: hello_world') wrap_hello() # to wrap any function at all, write a generic wrapper that takes the a function as input def logthis(...
dusenberrymw/incubator-systemml
samples/jupyter-notebooks/Image_Classify_Using_VGG_19_Transfer_Learning.ipynb
apache-2.0
!pip show systemml """ Explanation: Image Classification using Caffe VGG-19 model (Transfer Learning) This notebook demonstrates importing VGG-19 model from Caffe to SystemML and use that model to do an image classification. VGG-19 model has been trained using ImageNet dataset (1000 classes with ~ 14M images). If an i...
epfl-lts2/pyunlocbox
examples/playground.ipynb
bsd-3-clause
%matplotlib inline import numpy as np import matplotlib.pyplot as plt from pyunlocbox import functions, solvers plt.rcParams['figure.figsize'] = (17, 5) """ Explanation: Playing with the PyUNLocBoX https://github.com/epfl-lts2/pyunlocbox End of explanation """ f1 = functions.norm_l2(y=[4, 5, 6, 7]) f2 = functions....
allafort/StatisticalMethods
examples/XrayImage/Modeling.ipynb
gpl-2.0
import astropy.io.fits as pyfits import astropy.visualization as viz import matplotlib.pyplot as plt import numpy as np %matplotlib inline plt.rcParams['figure.figsize'] = (10.0, 10.0) """ Explanation: Forward Modeling the X-ray Image data In this notebook, we'll take a closer look at the X-ray image data products, an...
YzPaul3/h2o-3
h2o-py/demos/EEG_eyestate_sklearn_NOPASS.ipynb
apache-2.0
import pandas as pd import numpy as np from collections import Counter """ Explanation: Scikit-Learn singalong: EEG Eye State Classification Author: Kevin Yang Contact: kyang@h2o.ai This tutorial replicates Erin LeDell's oncology demo using Scikit Learn and Pandas, and is intended to provide a comparison of the syntac...
patrick-kidger/equinox
examples/frozen_layer.ipynb
apache-2.0
import functools as ft import jax import jax.numpy as jnp import jax.random as jrandom import optax # https://github.com/deepmind/optax import equinox as eqx # Toy data def get_data(dataset_size, *, key): x = jrandom.normal(key, (dataset_size, 1)) y = 5 * x - 2 return x, y # Toy dataloader def dataloa...
anhquan0412/deeplearning_fastai
deeplearning1/nbs/imagenet_batchnorm.ipynb
apache-2.0
from __future__ import division, print_function %matplotlib inline from importlib import reload import utils; reload(utils) from utils import * """ Explanation: This notebook explains how to add batch normalization to VGG. The code shown here is implemented in vgg_bn.py, and there is a version of vgg_ft (our fine tun...
lknelson/text-analysis-2017
03-Pandas_and_DTM/00-PandasAndTextAnalysis.ipynb
bsd-3-clause
import pandas import nltk import string import matplotlib.pyplot as plt #note this last import statement. Why might we use "import as"? #read in our data df = pandas.read_csv("../Data/childrens_lit.csv.bz2", sep = '\t', encoding = 'utf-8', compression = 'bz2', index_col=0) df """ Explanation: Combining Pandas and Tex...
Kreiswolke/gensim
docs/notebooks/word2vec.ipynb
lgpl-2.1
# import modules & set up logging import gensim, logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) sentences = [['first', 'sentence'], ['second', 'sentence']] # train word2vec on the two sentences model = gensim.models.Word2Vec(sentences, min_count=1) """ Explanation:...