repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
jegibbs/phys202-2015-work | days/day13/ODEs.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
"""
Explanation: Ordinary Differential Equations
Learning Objectives: Understand the numerical solution of ODEs and use scipy.integrate.odeint to solve and explore ODEs numerically.
Imports
End of explanation
"""
tmax = 10.0 ... |
condereis/credit-card-default | notebooks/Comparacao.ipynb | mit | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from scipy.stats import randint, uniform
from sklearn.decomposition import PCA
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cr... |
fja05680/pinkfish | examples/200.momentum-gem-portfolio/optimize.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import datetime
import pinkfish as pf
import strategy
# Format price data
pd.options.display.float_format = '{:0.2f}'.format
%matplotlib inline
# Set size of inline plots
'''note: rcParams can't be in same cell as import matplotlib
or %matplotlib inline
... |
lknelson/text-analysis-2017 | 02-IntroToNLP/00-IntroToNLP_ExerciseSolution.ipynb | bsd-3-clause | import nltk
import string
from nltk import word_tokenize
from nltk.corpus import stopwords
#open and read the novels, save them as variables
austen_string = open('../Data/Austen_PrideAndPrejudice.txt', encoding='utf-8').read()
alcott_string = open('../Data/Alcott_GarlandForGirls.txt', encoding='utf-8').read()
#tokeni... |
piscataway/datascience | lab/05 Comparison of Classification Algrithms.ipynb | mit | # Importing libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('bmh')
%matplotlib inline
# To learn more about the data set https://archive.ics.uci.edu/ml/datasets/pima+indians+diabetes
data_url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diab... |
manoharan-lab/structural-color | polarization_tutorial.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
import structcol as sc
from structcol import refractive_index as ri
from structcol import montecarlo as mc
from structcol import detector as det
import pymie as pm
from pymie import size_parameter, index_ratio
import seaborn as sns
import time
# For Jupyter notebooks... |
ES-DOC/esdoc-jupyterhub | notebooks/nerc/cmip6/models/ukesm1-0-ll/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'nerc', 'ukesm1-0-ll', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: NERC
Source ID: UKESM1-0-LL
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy B... |
sueiras/training | sklearn/02 - Regression models.ipynb | gpl-3.0 | from sklearn import datasets
all_data = datasets.california_housing.fetch_california_housing()
# Describe dataset
print(all_data.DESCR)
print(all_data.feature_names)
# Print some data lines
print(all_data.data[:10])
print(all_data.target)
#Randomize, normalize and separate train & test
from sklearn.utils import sh... |
honjy/foundations-homework | 05/spotify-homework-hon-june6.ipynb | mit | data = response.json()
data.keys()
artist_data = data['artists']
artist_data.keys()
lil_names = artist_data['items']
#lil_names = list of dictionaries = list of artist name, popularity, type, genres etc
"""
Explanation: & for multiple parameters
End of explanation
"""
for names in lil_names:
if not names['ge... |
EricChiquitoG/Simulacion2017 | Modulo1/Clase9_Repaso1(Mod.1).ipynb | mit | # Numeral 1
# Importar librerías necesarias
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# Definimos funcion mu
def mu(x, r):
return r*(1-x)
# Definimos conjunto de valores en x
x = np.linspace(0, 1.2, 50)
# Valor del parametro solicitado
r = 1
# Conjunto de valores en y
y = mu(x, r)
# G... |
fcollonval/coursera_data_visualization | WaterPumpsPrediction.ipynb | mit | training_data = pd.read_csv('training_set_values.csv', index_col=0)
training_label = pd.read_csv('training_set_labels.csv', index_col=0)
test_data = pd.read_csv('test_set_values.csv', index_col=0)
# Merge test data and training data to apply same data management operations on them
data = training_data.append(test_dat... |
yashdeeph709/Algorithms | PythonBootCamp/Complete-Python-Bootcamp-master/Collections Module.ipynb | apache-2.0 | from collections import Counter
"""
Explanation: Collections Module
The collections module is a built-in module that implements specialized container data types providing alternatives to Python’s general purpose built-in containers. We've already gone over the basics: dict, list, set, and tuple.
Now we'll learn about ... |
COMBINE-Canberra/bioinformatics-toolbox-talks | notebooks/tags.ipynb | cc0-1.0 | year = 2015
print(year)
print(year)
"""
Explanation: Tag Segmentation with the iPython Notebook
The iPython Notebook consists of a series of cells you can run code in. The Notebook remembers what you wrote previously.
Execute a cell by typing shift-enter
End of explanation
"""
year = 2016
"""
Explanation: The note... |
andymai92/Data_Science | Cross-Validation/Cross-Validation.ipynb | gpl-3.0 | from __future__ import print_function, division
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
%matplotlib inline
from sklearn.datasets import load_digits
digits = load_digits()
X = digits.data
y = digits.target
"""
Explanation: -------------------------------------<br>
(C) August... |
andrewjpage/Roary | contrib/roary_plots/roary_plots.ipynb | gpl-3.0 | # Plotting imports
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')
# Other imports
import os
import pandas as pd
import numpy as np
from Bio import Phylo
"""
Explanation: Roary pangenome plots
<h6><a href="javascript:toggle()" target="_self">Toggle source code</a></h6... |
Serulab/Py4Bio | notebooks/Chapter 2 - First Steps with Python.ipynb | mit | print('Hello World!')
print("Hello", "World!")
print("Hello","World!",sep=";")
print("Hello","World!",sep=";",end='\n\n')
name = input("Enter your name: ")
name
1+1
'1'+'1'
"A string of " + 'characters'
'The answer is ' + 42
'The answer is ' + str(42)
'The answer is {0}'.format(42)
number = 42
'The ans... |
deepchem/deepchem | examples/tutorials/Introduction_to_Molecular_Attention_Transformer.ipynb | mit | !pip install --pre deepchem
"""
Explanation: Introduction to the Molecular Attention Transformer.
In this tutorial we will learn more about the Molecular Attention Transformer, or MAT. MAT is a model based on transformers, aimed towards performing molecular prediction tasks. MAT is easy to tune and performs quite well... |
szymonm/pyspark-dataproc-workshop | rdd-first-steps.ipynb | apache-2.0 | import pyspark
sc = pyspark.SparkContext('local[*]')
# do something to prove it works
rdd = sc.parallelize(range(1000))
rdd.takeSample(False, 5)
"""
Explanation: Spark Context
Let's start with creating a SparkContext - an entry point to Spark application. Parameter 'local[*]' means that we create the Spark cluster lo... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/text_classification/labs/text_similarity.ipynb | apache-2.0 | # Install TF.Text TensorFlow library
# TODO 1: Your code here
"""
Explanation: Evaluating ROUGE-L Text Similarity Metric
Learning objectives
Install TF.Text TensorFlow library.
Compute LCS-based similarity score.
Overview
TensorFlow Text provides a collection of text-metrics-related classes and ops ready to use with... |
joverbee/electromagnetism_course | shielding.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
import numpy as np
import scipy.signal as signal
"""
Explanation: Example of electrostatic shielding by conductive objects
Demonstration of electrostatic shielding in a multiconductor case make use of numerical solution of Laplace equation with boundary conditions, to show redistributio... |
asierabreu/cosmics | demo/FITS-images-demo.ipynb | apache-2.0 | from astropy.utils.data import download_file
"""
Explanation: The following line is needed to download the example FITS files used here.
End of explanation
"""
from astropy.io import fits
image_file = download_file('http://data.astropy.org/tutorials/FITS-images/HorseHead.fits', cache=True )
"""
Explanation: Viewin... |
Brett777/Predict-Churn | Predictions for Tableau.ipynb | mit | import pandas as pd
import os
s3file = 'https://dsclouddata.s3.amazonaws.com/churn.csv'
churnDF = pd.read_csv(s3file, delimiter=',')
churnDF.head(5)
"""
Explanation: How to Write Python Objects to a Database for use with Tableau
1. Get Some Data
Start by accessing some data. In this example we read some data as a Pand... |
jorisroovers/machinelearning-playground | machine-learning/tensorflow/tensorflow_linear_regression.ipynb | apache-2.0 | %matplotlib inline
import tensorflow as tf
import numpy as np
# Let's use the seaborn library to easily get some data and plot it
import seaborn as sns
sns.set()
# Load 'tips' dataset, only plot 'total_bill', and 'tip' and features (there's a bunch more features in this dataset)
tips = sns.load_dataset("tips")
plt = s... |
mu4farooqi/deep-learning-projects | image-classification/dlnd_image_classification.ipynb | gpl-3.0 | """
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
"""
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
tar_gz_path = 'cifar-10-python.tar.gz'
class DLProgress... |
ngcm/training-public | FEEG6016 Simulation and Modelling/09-Stochastic-DEs-Lab-1.ipynb | mit | from IPython.core.display import HTML
css_file = 'https://raw.githubusercontent.com/ngcm/training-public/master/ipython_notebook_styles/ngcmstyle.css'
HTML(url=css_file)
"""
Explanation: Stochastic Differential Equations: Lab 1
End of explanation
"""
%matplotlib inline
import numpy
from matplotlib import pyplot
from... |
chinapnr/python_study | Python 基础课程/Python Basic Lesson 04 - 列表 list.ipynb | gpl-3.0 | # 创建列表
a = ['pig', 'cat', 'dog']
print(a)
# 用序号访问列表中的元素,支持双向
# 列表支持一种比较复杂的切片式访问,后面会有专门提及
print(a[1])
print(a[-1])
# 列表初始化
a = []
# 列表末尾追加元素
a.append('bird')
print(a)
a.append('snake')
print(a)
# 列表指定位置插入元素
a.insert(0,'sheep')
print(a)
# 列表删除指定序号的元素
a.pop(1)
print(a)
# 列表删除指定内容的元素
a = ['pig', 'cat', 'dog']
a.r... |
jepegit/cellpy | dev_utils/OCV_notebooks/cellpy_ocv.ipynb | mit | dd = cellreader.get(filename, logging_mode="INFO")
d, _ = helpers.split_experiment(dd, 90)
"""
Explanation: Load a cell
Only need a part of it, so using only the first 29 cycles (splitting on cycle 30)
End of explanation
"""
ocv_cycles = d.get_ocv(
interpolated=True, number_of_points=40, direction="down"
).rese... |
agile-geoscience/striplog | docs/tutorial/16_Block_logs.ipynb | apache-2.0 | from welly import Well
w = Well.from_las('P-129_out.LAS')
w
gr = w.data['GR']
gr
"""
Explanation: Block logs
We'd like to make blocky, upscaled versions of logs.
Let's load a well from an LAS File using welly:
End of explanation
"""
gr_blocky = gr.block(cutoffs=[40, 100])
gr_blocky.plot()
"""
Explanation: We c... |
statsmodels/statsmodels.github.io | v0.13.2/examples/notebooks/generated/contrasts.ipynb | bsd-3-clause | import numpy as np
import statsmodels.api as sm
"""
Explanation: Contrasts Overview
End of explanation
"""
import pandas as pd
url = "https://stats.idre.ucla.edu/stat/data/hsb2.csv"
hsb2 = pd.read_table(url, delimiter=",")
hsb2.head(10)
"""
Explanation: This document is based heavily on this excellent resource fr... |
GoogleCloudPlatform/ml-design-patterns | 03_problem_representation/rebalancing.ipynb | apache-2.0 | import itertools
import math
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
import xgboost as xgb
from tensorflow import keras
from tensorflow.keras import Sequential
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import MinMaxScaler
from sklea... |
mtasende/Machine-Learning-Nanodegree-Capstone | notebooks/prod/n12_data_descriptive_statistics.ipynb | mit | pred_df = u_data_df.loc[:,(slice(None), 'Close')]
pred_df.columns = pred_df.columns.droplevel('feature')
print(pred_df.shape)
pred_df.head()
missing_df = pred_df.isnull().sum() / pred_df.shape[0]
missing_df.hist(bins=200)
plt.xlabel('Missing data')
plt.ylabel('Number of symbols')
plt.axvline(x=0.01, color='r', label='... |
google/physics-math-tutorials | colabs/LSTM Example.ipynb | apache-2.0 | import matplotlib.pyplot as plt
import math
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import MinMaxScaler
"""
Explanation: Copyright 2021 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not... |
SCPSscience/Notebooks | Classification.ipynb | mit | # Import modules that contain functions we need
import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# Our data is the dichotomous key table and is defined as the word 'key'.
# key is set equal to the .csv file that is read by pandas.
# The .csv file must be in the same directory a... |
sympy/scipy-2017-codegen-tutorial | notebooks/50-chemical-kinetics-C.ipynb | bsd-3-clause | import json
import numpy as np
from scipy2017codegen.odesys import ODEsys
from scipy2017codegen.chem import mk_rsys
"""
Explanation: In this notebook we will generate C code and use CVode from the sundials suite to integrate the system of differential equations. Sundials is a well established and well tested open-sour... |
smorton2/think-stats | code/chap02exmine.ipynb | gpl-3.0 | from __future__ import print_function, division
%matplotlib inline
import numpy as np
import nsfg
import first
"""
Explanation: Examples and Exercises from Think Stats, 2nd Edition
http://thinkstats2.com
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/licenses/MIT
End of explanation
"""
t = [1,... |
Kaggle/learntools | notebooks/computer_vision/raw/ex_tpus.ipynb | apache-2.0 | !pip install -U -t /kaggle/working/ git+https://github.com/Kaggle/learntools.git
from learntools.core import binder
binder.bind(globals())
from learntools.deep_learning.ex_tpu import *
step_1.check()
"""
Explanation: In this exercise, you'll make your first submission to the Petals to the Metal competition. You'll le... |
telescopeuser/workshop_blog | wechat_tool_py3_local/reference/S-IPA-Workshop/workshop2/Web-Parcel-Bot-Python-WeChat/Web-Parcel-Bot-Python-WeChat.ipynb | mit | # from __future__ import unicode_literals, division
import time, datetime, requests, itchat
from itchat.content import *
import tagui as t
from time import localtime, strftime
# import pandas as pd
"""
Explanation: Intelligent Process Automation / Intelligent Agent
zhan.gu@nus.edu.sg
A workshop to develop & use an in... |
idies/pyJHTDB | examples/test_interp_DB.ipynb | apache-2.0 | import numpy as np
import pyJHTDB
from pyJHTDB.dbinfo import channel as info
npoints = 2**10
nskip = 2
p = np.random.random(
size = (npoints, int(0.55*info['ny']/nskip)-1, 3)).astype(np.float32)
p[..., 0] *= info['lx']
p[..., 1] *= info['dy'][::nskip][None, :p.shape[1]]
p[..., 1] += info['ynodes'][::nskip][No... |
gutin/DynamicPricingGame | test/evaluate_algorithms.ipynb | mit | import sys
import os
import matplotlib.pyplot as plt
import numpy.random as rn
import numpy as np
%matplotlib inline
# TODO: write the path to the root directory of the simulation game code below.
# It should have a README.md file under it and 'simulation_game', 'simulation_algos', 'test directories' under it.
path_... |
oditorium/blog | iPython/MonteCarlo3-EigenvectorsPCA.ipynb | agpl-3.0 | import numpy as np
d = 3
R = np.random.uniform(-1,1,(d,d))+np.eye(d)
C = np.dot(R.T, R)
#C = np.array(((5,2,3),(2,5,4),(3,4,5)))
C
"""
Explanation: iPython Cookbook - Monte Carlo III - Principal Components
Generating a Monte Carlo vector using eigenvector decomposition
Theory
Before we go into the implementation, a... |
DCPROGS/R-PROGS | pyScripts/.ipynb_checkpoints/RSOS2014-reproducing-figures-checkpoint.ipynb | gpl-2.0 | %matplotlib inline
from pylab import*
import numpy as np
import pandas as pd
import scipy.stats as stats
from statsmodels.stats.power import TTestIndPower
def norm_pdf(x, mu, sd):
dist = stats.norm(mu, sd)
return dist.pdf(x)
def run_simulation(mean, sigma, nobs, nsim=10000):
pval, diff = np.zeros(nsim), n... |
hunterherrin/phys202-2015-work | assignments/assignment03/NumpyEx02.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 2
Imports
End of explanation
"""
np.arange(1+1)
def np_fact(n):
"""Compute n! = n*(n-1)*...*1 using Numpy."""
x = np.arange(n) + 1
y = np.cumprod(x)
if n == 0:
re... |
sangheestyle/ml2015project | howto/model03_linear_model_and_DictVectorizer.ipynb | mit | import gzip
import cPickle as pickle
with gzip.open("../data/train.pklz", "rb") as train_file:
train_set = pickle.load(train_file)
with gzip.open("../data/test.pklz", "rb") as test_file:
test_set = pickle.load(test_file)
with gzip.open("../data/questions.pklz", "rb") as questions_file:
questions = pickle... |
mdda/fossasia-2016_deep-learning | notebooks/3-Autoencoders/8-Anomaly-Detection.ipynb | mit | import numpy as np
import theano
import lasagne
import matplotlib.pyplot as plt
%matplotlib inline
import gzip
import pickle
# Seed for reproducibility
np.random.seed(42)
# Download the MNIST digits dataset (actually, these are already downloaded locally)
# !wget -N --directory-prefix=./data/MNIST/ http://deeplearn... |
ES-DOC/esdoc-jupyterhub | notebooks/inpe/cmip6/models/sandbox-2/land.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'inpe', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: INPE
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Balan... |
susantabiswas/Natural-Language-Processing | Notebooks/Word_Prediction_using_Interpolated_Knesser_Ney.ipynb | mit | from nltk.util import ngrams
from collections import defaultdict
from collections import OrderedDict
import string
import time
import gc
from math import log10
start_time = time.time()
"""
Explanation: <u>Word prediction</u>
Language Model based on n-gram Probabilistic Model
Interpolated Knesser Ney Used
Highest Order... |
BrainIntensive/OnlineBrainIntensive | resources/nipype/nipype_tutorial/notebooks/basic_workflow.ipynb | mit | %pylab inline
import nibabel as nb
from nipy.labs.viz import plot_anat
# Let's create a short helper function to plot 3D NIfTI images
def plot_slice(fname):
# Load the image
img = nb.load(fname)
data = img.get_data()
# Cut in the middle of the brain
cut = int(data.shape[-1]/2)
# Plot the dat... |
Mecanon/morphing_wing | dynamic_model/notebooks/Static_Airfoil.ipynb | mit | %matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
import math
#Ipython Libraries
# Remember to remove when you pass to Spyder.
from IPython.display import Image
Image(filename='axis.png')
a1 = 1
a2 = 1
b1 = 1
b2 = 1
c1 = 1
c2 = 1
d1 = 1
d2 = 1
theta = math.radians(56.6737103129... |
google-research/fool-me-twice | notebooks/nli_baselines.ipynb | apache-2.0 | # Copyright 2021 The Google AI Language Team Authors.
#
# 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 applicable law ... |
aaschroeder/Titanic_example | Final_setup_GBoost.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
titanic=pd.read_csv('./titanic_clean_data.csv')
cols_to_norm=['Age','Fare']
col_norms=['Age_z','Fare_z']
titanic[col_norms]=titanic[cols_to_norm].apply(lambda x: (x-x.mean())/x.std())
titanic['cabin_clean']=(pd.notnull(titanic.Cabin))
from sklearn.cross_validation import trai... |
ellamil/bubblepopper | bubblepopper_1preprocessing.ipynb | mit | from sqlalchemy import create_engine
from sqlalchemy_utils import database_exists, create_database
import psycopg2
import newspaper
from datetime import datetime
import pickle
import pandas as pd
import numpy as np
with open ("bubble_popper_postgres.txt","r") as myfile:
lines = [line.replace("\n","") for line in... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/gapic/automl/showcase_automl_text_entity_extraction_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 text entity extraction model for online prediction
<table ali... |
AllenDowney/ThinkBayes2 | notebooks/chap14.ipynb | mit | # If we're running on Colab, install empiricaldist
# https://pypi.org/project/empiricaldist/
import sys
IN_COLAB = 'google.colab' in sys.modules
if IN_COLAB:
!pip install empiricaldist
# Get utils.py
from os.path import basename, exists
def download(url):
filename = basename(url)
if not exists(filename... |
inageorgescu/OpenStreeMap | P3_Open_street_map_20170415.ipynb | mit | from IPython.display import Image
Image("Malaga_map.jpg")
"""
Explanation: OpenStreetMap Project
Udacity Data Analyst Nanodegree Project 3: Data Wrangling with MongoDB
Florina Georgescu - Airbus Operations SL
Github: https://github.com/inageorgescu
Map Area: Málaga, Spain
https://www.openstreetmap.org/relation/340746... |
garth-wells/IA-maths-Jupyter | Lecture09.ipynb | mit | # Import NumPy and seed random number generator to make generated matrices deterministic
import numpy as np
np.random.seed(1)
# Create a symmetric matrix with random entries
A = np.random.rand(4, 4)
A = A + A.T
print(A)
"""
Explanation: Lecture 9 - change of basis
This lecture considered a change of basis for vectors... |
bcantarel/bcantarel.github.io | bicf_nanocourses/courses/python_2/lectures/day_1/pandas/Lec1_Pandas.ipynb | gpl-3.0 | import sys,os
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import pandas as pd
import numpy as np
import scipy
sns.set_style('white')
if not os.path.isdir('Figures'):
os.mkdir("Figures")
"""
Explanation: Basic data analysis with Pandas
Today we will learn how to:
- load a single cell R... |
drphilmarshall/StatisticalMethods | tutorials/Week1/GithubAndGoals.ipynb | gpl-2.0 | class SolutionMissingError(Exception):
def __init__(self):
Exception.__init__(self,"You need to complete the solution for this code to work!")
def REPLACE_WITH_YOUR_SOLUTION():
raise SolutionMissingError
REMOVE_THIS_LINE = REPLACE_WITH_YOUR_SOLUTION
"""
Explanation: Week 1 Tutorial
GitHub Workflow and ... |
mattsolo1/hmmerclust | demo/hmmerclust_demo.ipynb | gpl-2.0 | from hmmerclust import hmmerclust
import settings
"""
Explanation: hmmerclust
A python package for detecting a gene cluster of interest in a set of bacterial genomes followed by interactive analysis of the results using ipython/jupyter notebook. For example, it could be used for identifying genetic loci that encode bi... |
pysg/pyther | Parámetros de ecuaciones de estado (SRK, PR, RKPR)-Red Neuronal-Copy1.ipynb | mit | import numpy as np
import pandas as pd
import pyther as pt
"""
Explanation: 2. Parámetros de ecuaciones de estado cúbicas (SRK, PR, RKPR)
En esta sección se presenta una implementación en Python para calcular los parámetros de ecuaciones de estado cúbicas (SRK, PR, RKPR). Las 2 primeras ecuaciónes de estado SRK y PR, ... |
ftlml/11-11-2015 | tweet_sentiment.ipynb | gpl-2.0 | linesRDD = sc.textFile('tweets.tsv')
"""
Explanation: PySpark Docs
Spark Programming Guide
API Docs
Make sure you use are reading the docs for the correct version!
The version installed in the VM is Spark 1.5.1
You will need to use various transformations and actions for RDDs, as well as several classes in the MLlib... |
rashikaranpuria/Machine-Learning-Specialization | Regression/Assignmet_five/week-5-lasso-assignment-2-blank.ipynb | mit | import graphlab
"""
Explanation: Regression Week 5: LASSO (coordinate descent)
In this notebook, you will implement your very own LASSO solver via coordinate descent. You will:
* Write a function to normalize features
* Implement coordinate descent for LASSO
* Explore effects of L1 penalty
Fire up graphlab create
Make... |
AllenDowney/ModSimPy | examples/spiderman.ipynb | mit | # install Pint if necessary
try:
import pint
except ImportError:
!pip install pint
# download modsim.py if necessary
from os.path import exists
filename = 'modsim.py'
if not exists(filename):
from urllib.request import urlretrieve
url = 'https://raw.githubusercontent.com/AllenDowney/ModSim/main/'
... |
ES-DOC/esdoc-jupyterhub | notebooks/mpi-m/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', 'mpi-m', 'sandbox-1', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: MPI-M
Source ID: SANDBOX-1
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Ra... |
zenotech/zPost | ipynb/NASA_CRM/CRM.ipynb | bsd-3-clause | remote_data = True
remote_server_auto = True
case_name = 'dpw5_L3'
data_dir='/gpfs/thirdparty/zenotech/home/dstandingford/VALIDATION/NASA_CRM'
data_host='dstandingford@vis03'
paraview_cmd='mpiexec /gpfs/cfms/apps/zCFD/bin/pvserver'
if not remote_server_auto:
paraview_cmd=None
if not remote_data:
data_host='l... |
computational-class/cjc | code/04.PythonCrawler_selenium.ipynb | mit | from selenium import webdriver
help(webdriver)
"""
Explanation: 数据抓取
使用Selenium操纵浏览器
王成军
wangchengjun@nju.edu.cn
计算传播网 http://computational-communication.com
selenium 是一套完整的web应用程序测试系统,包含了
- 测试的录制(selenium IDE)
- 编写及运行(Selenium Remote Control)
- 测试的并行处理(Selenium Grid)。
Selenium的核心Selenium Core基于JsUnit,完全由JavaSc... |
DawesLab/LabNotebooks | Learning Pandas.ipynb | mit | # standard imports:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
# use inline plots:
%matplotlib inline
# use ggplot style:
matplotlib.style.use('ggplot')
"""
Explanation: (Run the last cell first in order to enable custom formatting)
Learning Pandas
AMCDawes
Dec 2015
Some... |
Alexoner/skynet | notebooks/BatchNormalization.ipynb | mit | # As usual, a bit of setup
import time
import numpy as np
import matplotlib.pyplot as plt
from skynet.neural_network.classifiers.fc_net import *
from skynet.utils.data_utils import get_CIFAR10_data
from skynet.utils.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from skynet.solvers.solver... |
MartyWeissman/Python-for-number-theory | PwNT Notebook 3.ipynb | gpl-3.0 | def is_prime(n):
'''
Checks whether the argument n is a prime number.
Uses a brute force search for factors between 1 and n.
'''
for j in range(2,n): # the list of numbers 2,3,...,n-1.
if n%j == 0: # is n divisible by j?
print "%d is a factor of %d."%(j,n)
return Fa... |
roaminsight/roamresearch | BlogPosts/Average_precision/further_testing.ipynb | apache-2.0 | __author__ = 'Nick Dingwall'
"""
Explanation: Further testing of the sklearn pull request
End of explanation
"""
import matplotlib.pyplot as plt
import matplotlib
%matplotlib inline
import numpy as np
from sklearn.metrics.base import _average_binary_score
from sklearn.metrics import precision_recall_curve
import war... |
mdeff/ntds_2016 | project/reports/stock_market/Final project Stock market.ipynb | mit | df = load_data()
#Shows which percentage of the data is loaded (long load time)
"""
Explanation: Project : Stock market analysis and prediction
Jeroen Le Maire --- A network tour of data science
This project aims to check if it is possible to discover ouperforming stocks by machine learning. The data is from Professer... |
kampta/kampta.github.io | _code/2016-3-20-Dominant-Colors.ipynb | mit | def get_colors(img, numcolors=5):
#image = image.resize((resize, resize))
result = img.convert('P', palette=Image.ADAPTIVE, colors=numcolors)
result.putalpha(0)
return result.getcolors()
image = Image.open(images[0])
%time colors = get_colors(image)
colors = get_colors(Image.open(images[0]))
colshow... |
google/meterstick | confidence_interval_display_demo.ipynb | apache-2.0 | !pip install meterstick
"""
Explanation: For External users
You can open this notebook in Google Colab.
Installation
You can install from pip for the stable version
End of explanation
"""
!git clone https://github.com/google/meterstick.git
import sys, os
sys.path.append(os.getcwd())
"""
Explanation: or from GitHub ... |
barjacks/foundations-homework | 07/Animal_Panda_Homework_7_Skinner.ipynb | mit | import pandas as pd
"""
Explanation: *1. Import pandas with the right name
End of explanation
"""
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: *2. Set all graphics from matplotlib to display inline
End of explanation
"""
#for encoding the command would look smth like this:
#df = pd.read_csv... |
fastai/fastai | nbs/05_data.transforms.ipynb | apache-2.0 | path = untar_data(URLs.MNIST_TINY)
(path/'train').ls()
#|export
def _get_files(p, fs, extensions=None):
p = Path(p)
res = [p/f for f in fs if not f.startswith('.')
and ((not extensions) or f'.{f.split(".")[-1].lower()}' in extensions)]
return res
#|export
def get_files(path, extensions=None, re... |
hanezu/cs231n-assignment | 17-assignment2/BatchNormalization.ipynb | mit | # As usual, a bit of setup
from __future__ import print_function
import time
import numpy as np
import matplotlib.pyplot as plt
from cs231n.classifiers.fc_net import *
from cs231n.data_utils import get_CIFAR10_data
from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_gradient_array
from cs231n.solv... |
ueapy/enveast_python_course_materials | Day_1/02-Basic-Python-Syntax.ipynb | mit | # set the midpoint
midpoint = 5
# make two empty lists
lower = []; upper = []
# split the numbers into lower and upper
for i in range(10):
if (i < midpoint):
lower.append(i)
else:
upper.append(i)
print("lower:", lower)
print("upper:", upper)
"""
Explanation: Python Language Syntax
... |
wzxiong/DAVIS-Machine-Learning | 208-final-project-xll/final 2.0.ipynb | mit | import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import numpy as np
import missingno as msno
import xgboost as xgb
from sklearn.preprocessing import scale
from xgboost.sklearn import XGBRegressor
from sklearn.linear_model import Ridge
from sklearn import cross_validation, metrics #Additional s... |
cleuton/datascience | datavisualization/data_visualization_python.ipynb | apache-2.0 | import numpy as np
%matplotlib inline
temp_cidade1 = np.array([33.15,32.08,32.10,33.25,33.01,33.05,32.00,31.10,32.27,33.81])
temp_cidade2 = np.array([35.17,36.23,35.22,34.33,35.78,36.31,36.03,36.23,36.35,35.25])
temp_cidade3 = np.array([22.17,23.25,24.22,22.31,23.18,23.31,24.11,23.53,24.38,21.25])
"""
Explanation: Vi... |
saketkc/hatex | 2015_Fall/MATH-578B/Homework4/Homework4.ipynb | mit | from math import log, exp, e
t_min_grow = log(10)/log(1.05)
rho = 10
A = 10
N = rho*A
print t_min_grow
"""
Explanation: Given
Density of bacteria in plate = $\rho= 10/cm^2$
Area $A=10cm^2$
Probability of a bacteria carrying mutation = $\mu$
Facts
Bacteria on plate are like 'white and black' balls in a box with thw w... |
SHDShim/pytheos | examples/6_p_scale_test_Heinz_Au.ipynb | apache-2.0 | %config InlineBackend.figure_format = 'retina'
"""
Explanation: For high dpi displays.
End of explanation
"""
import matplotlib.pyplot as plt
import numpy as np
from uncertainties import unumpy as unp
import pytheos as eos
"""
Explanation: 0. General note
This example compares pressure calculated from pytheos and o... |
btel/2015_eitn_swc_pandas | 06 - Reshaping data.ipynb | bsd-2-clause | df = pd.DataFrame({'subject':['A', 'A', 'B', 'B'],
'treatment':['CH', 'DT', 'CH', 'DT'],
'concentration':range(4)},
columns=['subject', 'treatment', 'concentration'])
df
"""
Explanation: Reshaping data with stack and unstack
Pivoting
Data is often stored in CSV ... |
rocketproplab/Guides | Guides/python/plotly-basic-plotting.ipynb | mit | dirPath = os.path.realpath('.')
fileName = 'assets/coolingExample.xlsx'
filePath = os.path.join(dirPath, fileName)
df = pd.read_excel(filePath,header=0)
cols = df.columns
"""
Explanation: Plotly Basics of Plotting
Importing Data
Let's start by importing our data using the methods described in the <code>excelToPandas</... |
SKA-ScienceDataProcessor/crocodile | examples/notebooks/facet-subgrid.ipynb | apache-2.0 | %matplotlib inline
from matplotlib import pylab
import matplotlib.patches as patches
import matplotlib.path as path
from ipywidgets import interact
import numpy
import sys
import random
import itertools
import time
import scipy.special
import math
pylab.rcParams['figure.figsize'] = 16, 10
pylab.rcParams['image.cmap']... |
kpolimis/kpolimis.github.io-src | output/downloads/notebooks/flights_analysis.ipynb | gpl-3.0 | from __future__ import division
from utils import *
"""
Explanation: Flights Analysis
The goal of this post is to visualize flights taken from Google location data using Python
* We will create a .gif progressing through individual flights and a .png of all flights
* This post utilizes code from Tyler Hartley's visua... |
mne-tools/mne-tools.github.io | 0.22/_downloads/2b710ad55cbf958235c0d74bf0b0d4ae/plot_evoked_ers_source_power.ipynb | bsd-3-clause | # Authors: Luke Bloy <luke.bloy@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
import mne
from mne.cov import compute_covariance
from mne.datasets import somato
from mne.time_frequency import csd_morlet
from mne.beamformer import (make_di... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/sdk_custom_tabular_regression_online_explain.ipynb | apache-2.0 | import os
# Google Cloud Notebook
if os.path.exists("/opt/deeplearning/metadata/env_version"):
USER_FLAG = "--user"
else:
USER_FLAG = ""
! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG
"""
Explanation: Vertex SDK: Custom training tabular regression model for online prediction with explainabilty
<... |
mne-tools/mne-tools.github.io | 0.12/_downloads/plot_time_frequency_simulated.ipynb | bsd-3-clause | # Authors: Hari Bharadwaj <hari@nmr.mgh.harvard.edu>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from mne import create_info, EpochsArray
from mne.time_frequency import tfr_multitaper, tfr_stockwell, tfr_morlet
print(__doc__)
"""
Explanation: =================... |
adricnet/dfirnotes | examples/win5mem-jupyter.ipynb | mit | !vol.py --plugins=/home/sosift/f/dfirnotes/ -f /cases/win5mem/winxp_java6-meterpreter.vmem --profile WinXPSP2x86 imageinfo
## Get setup to process memory with Volatility, analyse data with Pandas, chart with matplotlib
## Charting tips from https://datasciencelab.wordpress.com/2013/12/21/beautiful-plots-with-pandas-an... |
google/compass | packages/propensity/08.audience_generation.ipynb | apache-2.0 | # Uncomment to install required python modules
# !sh ../utils/setup.sh
# Add custom utils module to Python environment
import os
import sys
sys.path.append(os.path.abspath(os.pardir))
import numpy as np
import pandas as pd
import random
from gps_building_blocks.cloud.utils import bigquery as bigquery_utils
from uti... |
mayanks43/auto-tag | Linear_SVM.ipynb | mit | %matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from sklearn import preprocessing
from sklearn.datasets import make_blobs
from sklearn.svm import LinearSVC
x = np.linspace(-2.0, 2.0, num=100)
def huberizedHingeLoss(x, h):
if x > 1+h:
return 0
elif abs(1-x) <= h... |
algoix/blog | resource 1/Machine Learning for Trading.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from util import get_data, plot_data, fill_missing_values
%matplotlib inline
"""
Explanation: Notes for Machine Learning for Trading
Udacity - ud501
Part 1
End of explanation
"""
dates = pd.date_range('2014-01-01', '2014-12-31')
symbols = ['V']... |
barjacks/pythonrecherche | Kursteilnehmer/Sven Millischer/06 /01 Rückblick For-Loop-Übungen.ipynb | mit | primes = [2, 3, 5, 7]
for prime in primes:
print(prime)
"""
Explanation: 10 For-Loop-Rückblick-Übungen
In den Teilen der folgenden Übungen habe ich den Code mit "XXX" ausgewechselt. Es gilt in allen Übungen, den korrekten Code auszuführen und die Zelle dann auszuführen.
1.Drucke alle diese Prim-Zahlen aus:
End of... |
phoebe-project/phoebe2-docs | 2.0/tutorials/irrad_method_horvat.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.0,<2.1"
"""
Explanation: Lambert Scattering (irrad_method='horvat')
Setup
Let's first make sure we have the latest version of PHOEBE 2.0 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
"""... |
joverbee/electromagnetism_course | .ipynb_checkpoints/dipole-checkpoint.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Visualisation of the electrostatic dipole
This notebook shows how to numerically calculate and visualise the fields around an electrostatic dipole
It makes use of the superposition of the fields of 2 charged conducting spheres (to avoid divergence at ... |
amkatrutsa/MIPT-Opt | Spring2022/intro_gd.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
USE_COLAB = False
if not USE_COLAB:
plt.rc("text", usetex=True)
import numpy as np
C = 10
alpha = -0.5
q = 0.9
num_iter = 10
sublinear = np.array([C * k**alpha for k in range(1, num_iter + 1)])
linear = np.array([C * q**k for k in range(1, num_iter + 1)])
superli... |
leon-adams/datascience | notebooks/knn.ipynb | mpl-2.0 | # Run some setup code for this notebook.
import sys
import os
sys.path.append('..')
import random
import numpy as np
from algorithms.data_utils import load_CIFAR10
import matplotlib.pyplot as plt
# This is a bit of magic to make matplotlib figures appear inline in the notebook
# rather than in a new window.
%matplotl... |
Milad7m/motion | DM_08_04.ipynb | mit | % matplotlib inline
import pylab
import numpy as np
import pandas as pd
from hmmlearn.hmm import GaussianHMM
"""
Explanation: DM_08_04
Import packages
We'll create a hidden Markov model to examine the state-shifting in the dataset.
End of explanation
"""
df = pd.read_csv("speed.csv", sep = ",")
df.head(5)
"""
Exp... |
psci2195/espresso-ffans | doc/tutorials/11-ferrofluid/11-ferrofluid_part3.ipynb | gpl-3.0 | import espressomd
espressomd.assert_features('DIPOLES', 'LENNARD_JONES')
from espressomd.magnetostatics import DipolarP3M
import numpy as np
"""
Explanation: Ferrofluid - Part III
Table of Contents
Susceptibility with fluctuation formulas
Derivation of the fluctuation formula
Simulation
Magnetization curve of a 3D... |
jinzishuai/learn2deeplearn | deeplearning.ai/C4.CNN/week4_SpecialApps/hw/Neural Style Transfer/Art Generation with Neural Style Transfer - v2.ipynb | gpl-3.0 | import os
import sys
import scipy.io
import scipy.misc
import matplotlib.pyplot as plt
from matplotlib.pyplot import imshow
from PIL import Image
from nst_utils import *
import numpy as np
import tensorflow as tf
%matplotlib inline
"""
Explanation: Deep Learning & Art: Neural Style Transfer
Welcome to the second assi... |
drwalshaw/sc-python | 01-analysing-data.ipynb | mit | import numpy
numpy.loadtxt
numpy.loadtxt(fname='data/weather-01.csv' delimiter = ',')
numpy.loadtxt(fname='data/weather-01.csv'delimiter=',')
numpy.loadtxt(fname='data/weather-01.csv',delimiter=',')
"""
Explanation: analysing tabular data
End of explanation
"""
weight_kg=55
print (weight_kg)
print('weight in p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.