repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
mapattacker/cheatsheets | python/Basics of Algorithms.ipynb | mit | from IPython.display import Image
Image("../img/big_o1.png", width=600)
"""
Explanation: Basics of Algorithms & Coding Tests
this notebook shows some essentials and practical python codes to help in your coding test like hackerrank or codility
Two most important things
- remove all duplicates before any iterative pro... |
kostovhg/SoftUni | MathConceptsForDevelopers-Sep17/04_Hight-SchoolMaths-E/High-School Maths Exercise/Solutions.ipynb | gpl-3.0 | # IMPORTANT, you should run second cell with import statements
# or current cell should contain
# import sympy
x, a, b, c = sympy.symbols('x a b c') # Define symbols for parameters
sympy.init_printing() # LaTeX-formatted result for printing
sympy.solve(a * x**2 + b * x + c, x) # solve parametric equation
import math
... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/recommendation_systems/solutions/content_based_preproc.ipynb | apache-2.0 | import os
import tensorflow as tf
import numpy as np
from google.cloud import bigquery
PROJECT = 'cloud-training-demos' # REPLACE WITH YOUR PROJECT ID
BUCKET = 'cloud-training-demos-ml' # REPLACE WITH YOUR BUCKET NAME
REGION = 'us-central1' # REPLACE WITH YOUR BUCKET REGION e.g. us-central1
# do not change these
os.... |
NLP-Deeplearning-Club/Classic-ML-Methods-Algo | ipynbs/supervised/Perceptron.ipynb | mit | import requests
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder,StandardScaler
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import classification_report
"""
Explanation: 感知器
感知机(Perceptron)是一种二元线性分类器,是最简单的前向人工神经网络.1957由Ros... |
GoogleCloudPlatform/training-data-analyst | blogs/lightning/3_convnet.ipynb | apache-2.0 | %pip install cloudml-hypertune
BUCKET = 'cloud-training-demos-ml'
PROJECT = 'cloud-training-demos'
REGION = 'us-central1'
import os
os.environ['BUCKET'] = BUCKET
os.environ['PROJECT'] = PROJECT
os.environ['REGION'] = REGION
%%bash
gcloud config set project $PROJECT
gcloud config set compute/region $REGION
%load_ext... |
rsterbentz/phys202-2015-work | days/day11/Interpolation.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
"""
Explanation: Interpolation
Learning Objective: Learn to interpolate 1d and 2d datasets of structured and unstructured points using SciPy.
End of explanation
"""
x = np.linspace(0,4*np.pi,10)
x
"""
Explanation: Overview
W... |
Saxafras/Spacetime | Random Fields.ipynb | bsd-3-clause | state_overlay_diagram(field, random_states.get_causal_field(), t_max = 50, x_max = 50)
for state in random_states.causal_states():
print state.plc_configs()
for state in random_states.causal_states():
print state.morph()
t_trans = random_states.all_transitions(zipped = False)[1]
print np.unique(t_trans)
pri... |
tgrammat/ML-Data_Challenges | Reinforcement-Learning/TD0-models/01.TaxiProblem.ipynb | apache-2.0 | import gym
import random
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from collections import defaultdict, OrderedDict
env = gym.make('Taxi-v3')
print('OpenAI Gym environments for Taxi Problem:')
[k for k in gym.envs.registry.env_specs.keys() if k.find('Taxi', 0) >... |
mercybenzaquen/foundations-homework | databases_hw/db05/Homework_5_Graded.ipynb | mit | from bs4 import BeautifulSoup
from urllib.request import urlopen
html = urlopen("http://static.decontextualize.com/cats.html").read()
document = BeautifulSoup(html, "html.parser")
"""
Explanation: graded = 10/10
Homework #5
This homework presents a sophisticated scenario in which you must design a SQL schema, insert d... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emis... |
WaltGurley/jupyter-notebooks-intro | Jupyter - coding with Python.ipynb | mit | # import necessary objects
import pandas as pd
from matplotlib import pyplot
"""
Explanation: A (very) basic introduction Python in Jupyter notebooks
The purpose of this notebook is to get you started with using Python in Jupyter notebooks. This notebook is an introduction to using Python in a notebook with pandas, a ... |
turbomanage/training-data-analyst | courses/machine_learning/deepdive2/time_series_prediction/labs/4_modeling_keras.ipynb | apache-2.0 | import os
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import tensorflow as tf
from google.cloud import bigquery
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import (Dense, DenseFeatures... |
datascienceguide/datascienceguide.github.io | tutorials/Non-Linear-Regression-Tutorial.ipynb | mit | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from math import log
from sklearn import linear_model
#comment below if not using ipython notebook
%matplotlib inline
# load data into a pandas dataframe
data = pd.read_csv('../datasets/log_regression_example.csv')
#view first five datapoints
pri... |
SnShine/aima-python | text.ipynb | mit | from text import *
from utils import open_data
from notebook import psource
"""
Explanation: TEXT
This notebook serves as supporting material for topics covered in Chapter 22 - Natural Language Processing from the book Artificial Intelligence: A Modern Approach. This notebook uses implementations from text.py.
End of ... |
pysal/pysal | notebooks/viz/splot/mapping_vba.ipynb | bsd-3-clause | import pysal.lib as lp
from pysal.lib import examples
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
%matplotlib inline
"""
Explanation: Mapping with splot and PySAL
Imports
End of explanation
"""
link_to_data = examples.get_path('columbus.shp')
gdf ... |
planet-os/notebooks | api-examples/cams_covid_analysis.ipynb | mit | %matplotlib notebook
%matplotlib inline
import numpy as np
import dh_py_access.lib.datahub as datahub
import xarray as xr
import matplotlib.pyplot as plt
import ipywidgets as widgets
from mpl_toolkits.basemap import Basemap,shiftgrid
import dh_py_access.package_api as package_api
import matplotlib.colors as colors
impo... |
moonbury/pythonanywhere | github/MasteringMatplotlib/mmpl-big-data.ipynb | gpl-3.0 | import matplotlib
matplotlib.use('nbagg')
%matplotlib inline
"""
Explanation: Big Data
Table of Contents
Introduction
Visualization tools for large data sets
matplotlib and large data sets
Working with large data sources
On the file system with NumPy, Pandas, PyTables, CSV and HDF5
On distributed data stores with Had... |
ozorich/phys202-2015-work | assignments/midterm/InteractEx06.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import Image
from IPython.html.widgets import interact, interactive, fixed
"""
Explanation: Interact Exercise 6
Imports
Put the standard imports for Matplotlib, Numpy and the IPython widgets in the following cell.
End of explan... |
mholtrop/Phys605 | Python/Plotting/Plot_from_CSV_data.ipynb | gpl-3.0 | import pandas
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: Plotting data from Excel or CSV files
The plotting capabilities of the Excel spreadsheet program are intended for business plots, and so leave a lot to be desired for plotting scientific data. Fortunately, this is relatively easy in Pyth... |
ES-DOC/esdoc-jupyterhub | notebooks/cas/cmip6/models/fgoals-f3-l/ocean.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cas', 'fgoals-f3-l', 'ocean')
"""
Explanation: ES-DOC CMIP6 Model Properties - Ocean
MIP Era: CMIP6
Institute: CAS
Source ID: FGOALS-F3-L
Topic: Ocean
Sub-Topics: Timestepping Framework, Advecti... |
sbu-python-summer/python-tutorial | day-2/python-classes.ipynb | bsd-3-clause | class Container(object):
pass
a = Container()
a.x = 1
a.y = 2
a.z = 3
b = Container()
b.xyz = 1
b.uvw = 2
print(a.x, a.y, a.z)
print(b.xyz, b.uvw)
"""
Explanation: Classes
Classes are the fundamental concept for object oriented programming. A class defines a data type with both data and functions that ... |
yandexdataschool/gumbel_lstm | normal_lstm.ipynb | mit | %env THEANO_FLAGS="device=gpu3"
import numpy as np
import theano
import theano.tensor as T
import lasagne
import os
"""
Explanation: Contents
We train an LSTM with gumbel-sigmoid gates on a toy language modelling problem.
Such LSTM can than be binarized to reach signifficantly greater speed.
End of explanation
"""
... |
cathalmccabe/PYNQ | docs/source/getting_started/jupyter_notebooks_advanced_features.ipynb | bsd-3-clause | import random
the_number = random.randint(0, 10)
guess = -1
name = input('Player what is your name? ')
while guess != the_number:
guess_text = input('Guess a number between 0 and 10: ')
guess = int(guess_text)
if guess < the_number:
print(f'Sorry {name}, your guess of {guess} was too LOW.\n')
... |
drvinceknight/cfm | assets/assessment/mock/solution.ipynb | mit | ### BEGIN SOLUTION
import sympy as sym
a, b, c = sym.Symbol("a"), sym.Symbol("b"), sym.Symbol("c")
sym.expand((9 * a ** 2 * b * c ** 4) ** (sym.S(1) / 2) / (6 * a * b ** (sym.S(3) / 2) * c))
### END SOLUTION
"""
Explanation: Computing for Mathematics - Mock individual coursework
This jupyter notebook contains questio... |
mmaelicke/felis_python1 | felis_python1/lectures/05_Functions.ipynb | mit | print('Hello, Wolrd!')
print('This is Python.')
"""
Explanation: Functions
In Python it's realy easy to define your own functions. Once defined, you can use them just like any standard Python function. By condensing functionality into a function, your code will get structured and is way more readable. Beside that this... |
Olsthoorn/TransientGroundwaterFlow | exercises_notebooks/TransientFlowToAWell.ipynb | gpl-3.0 | import numpy as np
from scipy.special import expi
#help(expi) # remove the first # to show the help for the function expi
"""
Explanation: Transient flow to a well
The Theis' well function (a well in a confined aquifer)
The Theis will function is perhaps the most famous, and most often used and practical analytical s... |
CSB-book/CSB | good_code/solutions/Lahti2014_solution_detailed.ipynb | gpl-3.0 | import csv # Import csv modulce for reading the file
"""
Explanation: Solution of Lahti et al. 2014
Write a function that takes as input a dictionary of constraints (i.e., selecting a specific group of records) and returns a dictionary tabulating the BMI group for all the records matching the constraints. For example,... |
kubeflow/kfserving-lts | docs/samples/v1alpha2/transformer/image_transformer/kfserving_sdk_transformer.ipynb | apache-2.0 | from kubernetes import client
from kfserving import KFServingClient
from kfserving import constants
from kfserving import V1alpha2EndpointSpec
from kfserving import V1alpha2PredictorSpec
from kfserving import V1alpha2TransformerSpec
from kfserving import V1alpha2PyTorchSpec
from kfserving import V1alpha2CustomSpec
fro... |
MTG/essentia | src/examples/python/musicbricks-tutorials/5-melody_analysis.ipynb | agpl-3.0 | # import essentia in standard mode
import essentia
import essentia.standard
from essentia.standard import *
"""
Explanation: Melody analysis - MusicBricks Tutorial
Introduction
This tutorial will guide you through some tools for Melody Analysis using the Essentia library (http://www.essentia.upf.edu). Melody analysis ... |
cuttlefishh/emp | methods/figure-data/fig-1/Fig1_data_files.ipynb | bsd-3-clause | # Load up metadata map
metadata_fp = '../../../data/mapping-files/emp_qiime_mapping_qc_filtered.tsv'
metadata = pd.read_csv(metadata_fp, header=0, sep='\t')
metadata.head()
metadata.columns
# take just the columns we need for this figure panel
fig1ab = metadata.loc[:,['#SampleID','empo_0','empo_1','empo_2','empo_... |
NuGrid/NuPyCEE | regression_tests/SYGMA_SSP_h_yield_input.ipynb | bsd-3-clause | #from imp import *
#s=load_source('sygma','/home/nugrid/nugrid/SYGMA/SYGMA_online/SYGMA_dev/sygma.py')
#%pylab nbagg
import sys
import sygma as s
print (s.__file__)
s.__file__
#import matplotlib
#matplotlib.use('nbagg')
import matplotlib.pyplot as plt
#matplotlib.use('nbagg')
import numpy as np
from scipy.integrate imp... |
natronics/JSBSim-Manager | rocket.ipynb | gpl-3.0 | import locale
from openrocketdoc import document
from openrocketdoc import writers
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
###############################################################
# CHANGE THESE NUMBERS!! IT'S FUN.
thrust = 1555.0 # N
burn_time = 10.0 # s
isp = 214.0 # s
##############... |
YihaoLu/pyfolio | pyfolio/examples/portfolio_volatility_weighted_example.ipynb | apache-2.0 | # USAGE: Equal-Weight Portfolio.
# 1) if 'exclude_non_overlapping=True' below, the portfolio will only contains
# days which are available across all of the algo return timeseries.
#
# if 'exclude_non_overlapping=False' then the portfolio returned will span from the
# earliest startdate of any algo, thru the... |
sdpython/ensae_teaching_cs | _doc/notebooks/td2a/td2a_correction_session_1.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
from jyquickhelper import add_notebook_menu
add_notebook_menu()
"""
Explanation: 2A.data - DataFrame et Graphes - correction
Opérations standards sur les dataframes (pandas) et les matrices (numpy). Graphiques avec matplotlib).
End of explanation
"""
import pandas
... |
lithiumdenis/MLSchool | 2. Бостон.ipynb | mit | from sklearn.datasets import load_boston
bunch = load_boston()
print(bunch.DESCR)
X, y = pd.DataFrame(data=bunch.data, columns=bunch.feature_names.astype(str)), bunch.target
X.head()
"""
Explanation: Загрузим данные
End of explanation
"""
SEED = 22
np.random.seed = SEED
"""
Explanation: Зафиксируем генератор сл... |
santipuch590/deeplearning-tf | dl_tf_BDU/1.Intro_TF/ML0120EN-1.1-Exercise-TensorFlowHelloWorld.ipynb | mit | %matplotlib inline
import tensorflow as tf
import matplotlib.pyplot as plt
"""
Explanation: <center> "Hello World" in TensorFlow - Exercise Notebook</center>
Before everything, let's import the TensorFlow library
End of explanation
"""
a = tf.constant([5])
b = tf.constant([2])
"""
Explanation: First, try to add th... |
ghvn7777/ghvn7777.github.io | content/fluent_python/7_decorate.ipynb | apache-2.0 | def deco(func):
def inner():
print('running inner()')
return inner()
@deco
def target():
print('running target()')
target
"""
Explanation: 装饰器用于在源码中 “标记” 函数,以某种方式增强函数行为。这是一项强大的功能,但是如果想掌握,必须理解闭包
nonlocal 是新出现的关键字,在 Python 3.0 中引入。作为 Python 程序员,如果严格遵守基于类的面向对象编程方式,即使不知道这个关键字也没事,但是如果想自己实现函数装饰器,那就... |
ryan-leung/PHYS4650_Python_Tutorial | notebooks/04-Introduction-to-Pandas.ipynb | bsd-3-clause | import pandas
pandas.__version__
import pandas as pd
import numpy as np
"""
Explanation: Python Data Analytics
<img src="images/pandas_logo.png" alt="pandas" style="width: 400px;"/>
Pandas is a numerical package used extensively in data science. You can call the install the pandas package by
pip install pandas
Like ... |
tpin3694/tpin3694.github.io | machine-learning/linear_regression_scikitlearn.ipynb | mit | import pandas as pd
from sklearn import linear_model
import random
import numpy as np
%matplotlib inline
"""
Explanation: Title: Linear Regression
Slug: linear_regression
Summary: A simple example of linear regression in scikit-learn
Date: 2016-08-19 12:00
Category: Machine Learning
Tags: Linear Regression
Authors: ... |
FowlerLab/Enrich2 | docs/notebooks/unique_barcodes.ipynb | bsd-3-clause | % matplotlib inline
from __future__ import print_function
import os.path
from collections import Counter
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from enrich2.variant import WILD_TYPE_VARIANT
import enrich2.plots as enrich_plot
pd.set_option("display.max_rows", 10) # rows shown when prett... |
atulsingh0/MachineLearning | scikit-learn/01_Scikit.ipynb | gpl-3.0 | from sklearn.neighbors import KNeighborsClassifier
# instantiate the KN
knn = KNeighborsClassifier(n_neighbors=2)
# training the model
knn.fit(X, y)
#predict the value [5,4,3,2]
knn.predict([5,4,3,2])
knn.predict([[5,4,3,2], [1,2,3,5]])
"""
Explanation: Choosing KNN Classifier algorithm to predict the IRIS data
En... |
ES-DOC/esdoc-jupyterhub | notebooks/mohc/cmip6/models/sandbox-1/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'mohc', 'sandbox-1', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: MOHC
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, Conce... |
ES-DOC/esdoc-jupyterhub | notebooks/csir-csiro/cmip6/models/sandbox-3/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'csir-csiro', 'sandbox-3', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CSIR-CSIRO
Source ID: SANDBOX-3
Topic: Aerosol
Sub-Topics: Transport, Emis... |
Kaggle/learntools | notebooks/computer_vision/raw/tut5.ipynb | apache-2.0 | #$HIDE_INPUT$
# Imports
import os, warnings
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
import tensorflow as tf
from tensorflow.keras.preprocessing import image_dataset_from_directory
# Reproducability
def set_seed(seed=31415):
np.random.seed(seed)
tf.random.set_seed(see... |
statsmodels/statsmodels.github.io | v0.13.1/examples/notebooks/generated/tsa_filters.ipynb | bsd-3-clause | %matplotlib inline
import pandas as pd
import matplotlib.pyplot as plt
import statsmodels.api as sm
dta = sm.datasets.macrodata.load_pandas().data
index = pd.Index(sm.tsa.datetools.dates_from_range("1959Q1", "2009Q3"))
print(index)
dta.index = index
del dta["year"]
del dta["quarter"]
print(sm.datasets.macrodata.N... |
rvperry/phys202-2015-work | assignments/assignment06/DisplayEx01.ipynb | mit | from IPython.display import display
from IPython.display import Image
from IPython.display import HTML
assert True # leave this to grade the import statements
"""
Explanation: Display Exercise 1
Imports
Put any needed imports needed to display rich output the following cell:
End of explanation
"""
Image(url='http:/... |
mne-tools/mne-tools.github.io | 0.20/_downloads/006560919734f06efa76c80dc321a748/plot_object_source_estimate.ipynb | bsd-3-clause | import os
from mne import read_source_estimate
from mne.datasets import sample
print(__doc__)
# Paths to example data
sample_dir_raw = sample.data_path()
sample_dir = os.path.join(sample_dir_raw, 'MEG', 'sample')
subjects_dir = os.path.join(sample_dir_raw, 'subjects')
fname_stc = os.path.join(sample_dir, 'sample_au... |
mayankjohri/LetsExplorePython | Section 1 - Core Python/Chapter 02 - Data Types Part - 1/2.3. Operators.ipynb | gpl-3.0 | a = 10
b = 22
print("a =", a, ", b =", b)
print("~~~~~~~~~~~~~~~~~")
print("a + b:\t", a + b)
print("a - b:\t", a - b)
print("a * b:\t", a * b)
print("a / b:\t", a / b)
print("a//b:\t", a//b)
print("a % b:\t", a % b)
print("-a:\t", -a)
print("a < b:\t", a < b)
print("a > b:\t", a > b)
print("a <= b:\t", a <= b)
print("... |
awhite40/pymks | notebooks/elasticity_2D_Multiphase.ipynb | mit | %matplotlib inline
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
n = 21
n_phases = 3
from pymks.tools import draw_microstructures
from pymks.datasets import make_delta_microstructures
X_delta = make_delta_microstructures(n_phases=n_phases, size=(n, n))
"""
Explanation: Line... |
mne-tools/mne-tools.github.io | dev/_downloads/1b3716673f2aeae3f2b0c6c336812aba/80_fix_bem_in_blender.ipynb | bsd-3-clause | # Authors: Marijn van Vliet <w.m.vanvliet@gmail.com>
# Ezequiel Mikulan <e.mikulan@gmail.com>
# Manorama Kadwani <manorama.kadwani@gmail.com>
#
# License: BSD-3-Clause
import os
import shutil
import mne
data_path = mne.datasets.sample.data_path()
subjects_dir = data_path / 'subjects'
bem_dir = subje... |
dolittle007/dolittle007.github.io | notebooks/GLM-linear.ipynb | gpl-3.0 | %matplotlib inline
from pymc3 import *
import numpy as np
import matplotlib.pyplot as plt
"""
Explanation: GLM: Linear regression
Author: Thomas Wiecki
This tutorial is adapted from a blog post by Thomas Wiecki called "The Inference Button: Bayesian GLMs made easy with PyMC3".
This tutorial appeared as a post in a ... |
bayesimpact/bob-emploi | data_analysis/notebooks/research/job_similarity/rome_mobility_similarity.ipynb | gpl-3.0 | from os import path
import pandas
import seaborn as _
rome_version = 'v330'
data_folder = '../../../data'
rome_folder = path.join(data_folder, 'rome/csv')
mobility_csv = path.join(rome_folder, 'unix_rubrique_mobilite_{}_utf8.csv'.format(rome_version))
rome_csv = path.join(rome_folder, 'unix_referentiel_code_rome_{}_ut... |
brian-rose/ClimateModeling_courseware | Lectures/Lecture15 -- Insolation.ipynb | mit | # Ensure compatibility with Python 2 and 3
from __future__ import print_function, division
"""
Explanation: ATM 623: Climate Modeling
Brian E. J. Rose, University at Albany
Lecture 15: Insolation
Warning: content out of date and not maintained
You really should be looking at The Climate Laboratory book by Brian Rose,... |
kylepjohnson/notebooks | hands_on_machine_learning/chapter_2_end_to_end_machine_learning_project.ipynb | mit | import os
import pandas as pd
housing_file = os.path.expanduser('~/handson-ml/datasets/housing/housing.csv')
def load_housing_data(housing_path):
return pd.read_csv(housing_path)
housing = load_housing_data(housing_file)
housing.head()
housing.info()
housing["ocean_proximity"].value_counts()
housing.describe... |
mne-tools/mne-tools.github.io | 0.17/_downloads/0c01a2fff1983eb8b64e3b93aea3242d/plot_topo_compare_conditions.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.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()
"""
... |
numerical-mooc/assignment-bank-2015 | croberts94/Final Project.ipynb | mit | #Import necessary libraries and functions
import numpy as np
from scipy.stats import norm #Phi() is the normal CDF
#Allow plots in notebook and format plots
%matplotlib inline
import matplotlib.pyplot as pyplot
from matplotlib import rcParams
rcParams['figure.dpi'] = 100
rcParams['font.size'] = 16
rcParams['font.famil... |
statsmodels/statsmodels.github.io | v0.12.2/examples/notebooks/generated/pca_fertility_factors.ipynb | bsd-3-clause | %matplotlib inline
import matplotlib.pyplot as plt
import statsmodels.api as sm
from statsmodels.multivariate.pca import PCA
plt.rc("figure", figsize=(16,8))
plt.rc("font", size=14)
"""
Explanation: statsmodels Principal Component Analysis
Key ideas: Principal component analysis, world bank data, fertility
In this n... |
gsentveld/lunch_and_learn | notebooks/Unzip_Files_Keep_CSV_Files.ipynb | mit | # Get the project folders that we are interested in
PROJECT_DIR = os.path.dirname(dotenv_path)
EXTERNAL_DATA_DIR = PROJECT_DIR + os.environ.get("EXTERNAL_DATA_DIR")
RAW_DATA_DIR = PROJECT_DIR + os.environ.get("RAW_DATA_DIR")
# Get the list of filenames
files=os.environ.get("FILES").split()
print("Project directory is... |
ES-DOC/esdoc-jupyterhub | notebooks/ncc/cmip6/models/sandbox-2/atmos.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: NCC
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiation, Turbulen... |
malogrisard/NTDScourse | algorithms/02_ass_clustering.ipynb | mit | # Load libraries
# Math
import numpy as np
# Visualization
%matplotlib notebook
import matplotlib.pyplot as plt
plt.rcParams.update({'figure.max_open_warning': 0})
from mpl_toolkits.axes_grid1 import make_axes_locatable
from scipy import ndimage
# Print output of LFR code
import subprocess
# Sparse matrix
import ... |
bigdata-i523/hid335 | project/BDA-Project-Data.ipynb | gpl-3.0 | import requests, zipfile, io
import pandas as pd
URL = 'http://samhda.s3-us-gov-west-1.amazonaws.com/s3fs-public/field-uploads-protected/studies/NSDUH-2015/NSDUH-2015-datasets/NSDUH-2015-DS0001/NSDUH-2015-DS0001-bundles-with-study-info/NSDUH-2015-DS0001-bndl-data-tsv.zip'
def get_data():
r = requests.get('http://... |
cdt15/lingam | examples/DrawGraph.ipynb | mit | import numpy as np
import pandas as pd
import graphviz
import lingam
from lingam.utils import make_dot
print([np.__version__, pd.__version__, graphviz.__version__, lingam.__version__])
np.set_printoptions(precision=3, suppress=True)
np.random.seed(0)
"""
Explanation: Draw Causal Graph
Import and settings
In this exa... |
leriomaggio/numpy_euroscipy2015 | 04_sparse_matrices.ipynb | mit | import numpy as np
# Create a random array with a lot of zeros
X = np.random.random((10, 5))
print(X)
X[X < 0.7] = 0 # note: fancy indexing
print(X)
from scipy import sparse
# turn X into a csr (Compressed-Sparse-Row) matrix
X_csr = sparse.csr_matrix(X)
print(X_csr)
# convert the sparse matrix to a dense array
pr... |
malogrisard/NTDScourse | toolkit/04_ex_visualization.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# Random time series.
n = 1000
rs = np.random.RandomState(42)
data = rs.randn(n, 4).cumsum(axis=0)
plt.figure(figsize=(15,5))
plt.plot(data[:, :])
# df = pd.DataFrame(...)
# df.plot(...)
"""
Explanation: A Python Tour of Data ... |
mne-tools/mne-tools.github.io | 0.17/_downloads/d25fdfa446b06c82b756855681845935/plot_mne_dspm_source_localization.ipynb | bsd-3-clause | # sphinx_gallery_thumbnail_number = 10
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
"""
Explanation: Source localization with MNE/dSPM/sLORETA/eLORETA
The aim of this tutorial is to teach you how to com... |
AllenDowney/ThinkBayes2 | notebooks/chap18.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... |
andreaaraldo/BROKEN-PJ | anomaly_detection.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_samples, silhouette_score
# We resort to a third party library to plot silhouette diagrams
! pip install yellowbrick
from ye... |
eggie5/UCSD-MAS-DSE230 | hmwk1/HW-1.ipynb | mit | import findspark
findspark.init()
import pyspark
sc = pyspark.SparkContext()
textRDD = sc.newAPIHadoopFile('Data/Moby-Dick.txt',
'org.apache.hadoop.mapreduce.lib.input.TextInputFormat',
'org.apache.hadoop.io.LongWritable',
'org.a... |
oasis-open/cti-python-stix2 | docs/guide/environment.ipynb | bsd-3-clause | from stix2 import Environment, MemoryStore
env = Environment(store=MemoryStore())
"""
Explanation: Using Environments
An Environment object makes it easier to use STIX 2 content as part of a larger application or ecosystem. It allows you to abstract away the nasty details of sending and receiving STIX data, and to cr... |
donaghhorgan/COMP9033 | labs/04b - Extracting features from text data.ipynb | gpl-3.0 | import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
"""
Explanation: Lab 04b: Extracting text features
Introduction
This lab demonstrates feature extraction with text data. At the end of the lab, you should be able to use pandas and scikit-learn to:
Extract TF-IDF features from text data.... |
MTG/sms-tools | notebooks/E1-Python-and-sounds.ipynb | agpl-3.0 | import sys
import os
import numpy as np
# to use this notebook with colab uncomment the next line
# !git clone https://github.com/MTG/sms-tools.git
# and change the next line to sys.path.append('sms-tools/software/models/')
sys.path.append('../software/models/')
from utilFunctions import wavread, wavwrite
# E1 - 1.1: ... |
JanetMatsen/Neo4j_meta4 | jupyter/old/java_calls_from_python_and_plotting.ipynb | gpl-3.0 | subprocess.check_output(['echo', 'hello'])
! pwd
! ls -l ../ConnectedComponents.jar
example_result = subprocess.check_output(['java', '-jar', '../ConnectedComponents.jar', '0.03'])
example_result
type(example_result)
print(example_result)
result_string = str(example_result,'utf-8')
type(result_string)
import r... |
ajdawson/python_for_climate_scientists | course_content/notebooks/object_oriented_programming.ipynb | gpl-3.0 | class A(object):
pass
"""
Explanation: Object Oriented Programming
What is an Object?
First some semantics:
- An object is essentially a container which holds some data, and crucially some associated methods for working with that data.
- We define objects, and their behaviours, using something called a class.
... |
arongdari/almc | notebooks/Growth_Rate_of_Knowledge_Graph.ipynb | gpl-2.0 | def construct_freebase(shuffle = True):
e_file = '../data/freebase/entities.txt'
r_file = '../data/freebase/relations.txt'
datafile = '../data/freebase/train_single_relation.txt'
with open(e_file, 'r') as f:
e_list = [line.strip() for line in f.readlines()]
with open(r_file, 'r') as f:
... |
ELind77/gensim | docs/notebooks/sklearn_wrapper.ipynb | lgpl-2.1 | from gensim.sklearn_integration import SklLdaModel
"""
Explanation: Using wrappers for Scikit learn API
This tutorial is about using gensim models as a part of your scikit learn workflow with the help of wrappers found at gensim.sklearn_integration
The wrappers available (as of now) are :
* LdaModel (gensim.sklearn_in... |
JoseGuzman/myIPythonNotebooks | MachineLearning/NaiveBayesanClassifier.ipynb | gpl-2.0 | %pylab inline
import pandas as pd
# first row contains units
df = pd.read_excel(io='../data/Cell_types.xlsx', sheetname='PFC', skiprows=1)
del df['CellID'] # remove column with cell IDs
df.head() # show first elements
"""
Explanation: <H1> Naive Bayesan classifier</H1>
<H2>Bayesan theorem</H2>
We will try to comp... |
tensorflow/docs | site/en/tutorials/images/cnn.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... |
mjbrodzik/ipython_notebooks | charis/Calculate_ti_model_overall_variability.ipynb | apache-2.0 | from __future__ import print_function
%pylab notebook
# import datetime as dt
import glob
import matplotlib.pyplot as plt
#import matplotlib.dates as md
#from nose.tools import set_trace
import pandas as pd
import re
import seaborn as sns
import os
import sys
sns.set()
sns.axes_style("darkgrid")
"""
Explanation: Using... |
uliang/First-steps-with-the-Python-language | Day 1 - Unit 1.3.ipynb | mit | # Our first function
def my_first_function():
pass
"""
Explanation: 9. Python functions
Sometimes, a portion of code is reused over and over again in the entire script. To prevent repetitive coding, we are able to define our own custom defined functions using the def keyword. When invoked, functions will instruc... |
materialsvirtuallab/ceng114 | lectures/Lecture 14 - Climate Change analysis.ipynb | bsd-2-clause | from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here... |
ToqueWillot/M2DAC | FDMS/TME3/Model_V7.ipynb | gpl-2.0 | # from __future__ import exam_success
from __future__ import absolute_import
from __future__ import print_function
# Standard imports
%matplotlib inline
import os
import sklearn
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import random
import pandas as pd
import scipy.stats as stats
# ... |
deeplook/notebooks | meetups/meetup_analysis.ipynb | mit | %matplotlib inline
import re
import os
import json
import requests
import pandas as pd
server = 'https://api.meetup.com'
group_urlname = 'Python-Users-Berlin-PUB'
from meetup_api_key import key
"""
Explanation: Analysing Public Member Info on Meetup.com
In this notebook we do some simple analysis of information abo... |
Unidata/unidata-python-workshop | notebooks/Jupyter_Notebooks/Plotting and Interactivity.ipynb | mit | # Import matplotlib as use the inline magic so plots show up in the notebook
import matplotlib.pyplot as plt
%matplotlib inline
# Make some "data"
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y = [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
"""
Explanation: <div style="width:1000 px">
<div style="float:right; width:98 px; heig... |
google-aai/sc17 | cats/step_4_to_4_part1.ipynb | apache-2.0 | # Enter your username:
YOUR_GMAIL_ACCOUNT = '******' # Whatever is before @gmail.com in your email address
# Libraries for this section:
import os
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import pandas as pd
import cv2
import warnings
warnings.filterwarnings('ignore')
# Grab... |
JackDi/phys202-2015-work | assignments/assignment07/AlgorithmsEx02.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
"""
Explanation: Algorithms Exercise 2
Imports
End of explanation
"""
s=[]
i=0
def find_peaks(a):
"""Find the indices of the local maxima in a sequence."""
# YOUR CODE HERE
if a[0]>a[1]: #if the first number... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_cluster_stats_time_frequency_repeated_measures_anova.ipynb | bsd-3-clause | # Authors: Denis Engemann <denis.engemann@gmail.com>
# Eric Larson <larson.eric.d@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import io
from mne.time_frequency import sing... |
karlstroetmann/Formal-Languages | Python/Regexp-2-NFA.ipynb | gpl-2.0 | class RegExp2NFA:
def __init__(self, Sigma):
self.Sigma = Sigma
self.StateCount = 0
"""
Explanation: From Regular Expressions to <span style="font-variant:small-caps;">Fsm</span>s
This notebook shows how a given regular expression $r$ can be transformed into an equivalent finite state machine.... |
drvinceknight/gt | nbs/chapters/08-Evolutionary-Game-Theory.ipynb | mit | import numpy as np
import nashpy as nash
import matplotlib.pyplot as plt
"""
Explanation: Evolutionary Game Theory
In the previous chapter, we considered the case of fitness being independant of the distribution of the whole population (the rates of increase of 1 type just depended on the quantity of that type). That ... |
mercybenzaquen/foundations-homework | foundations_hw/08/Homework8_benzaquen_police_killings.ipynb | mit | !pip install pandas
!pip install matplotlib
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: The Counted (project by The Guardian to count the people killed by police in the US)
Why is this necessary?
From The Guardian's http://www.theguardian.com/us-news/ng-interactive/2015/ju... |
ajdawson/python_for_climate_scientists | course_content/notebooks/matplotlib_intro.ipynb | gpl-3.0 | import matplotlib.pyplot as plt
"""
Explanation: An introduction to matplotlib
Matplotlib is a Python package used widely throughout the scientific Python community to produce high quality 2D publication graphics. It transparently supports a wide range of output formats including PNG (and other raster formats), PostSc... |
zhmz90/DeepLearningCourseFromGoogle | udacity/2_fullyconnected.ipynb | mit | # These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
import cPickle as pickle
import numpy as np
import tensorflow as tf
"""
Explanation: Deep Learning
Assignment 2
Previously in 1_notmnist.ipynb, we created a pickle with formatted datasets for training, developm... |
DeepLearningUB/EBISS2017 | 1. Learning from data and optimization.ipynb | mit | # numerical derivative at a point x
def f(x):
return x**2
def fin_dif(x, f, h = 0.00001):
'''
This method returns the derivative of f at x
by using the finite difference method
'''
return (f(x+h) - f(x))/h
x = 2.0
print "{:2.4f}".format(fin_dif(x,f))
"""
Explanation: Basic Concepts
What is "... |
vravishankar/Jupyter-Books | pandas/01.Pandas - Series Object.ipynb | mit | import numpy as np
import pandas as pd
pd.__version__
np.__version__
# set some options to control output display
pd.set_option('display.notebook_repr_html',False)
pd.set_option('display.max_columns',10)
pd.set_option('display.max_rows',10)
"""
Explanation: Pandas
Pandas is a high-performance python library that pro... |
ARM-software/lisa | ipynb/deprecated/examples/trace_analysis/TraceAnalysis_FunctionsProfiling.ipynb | apache-2.0 | import logging
from conf import LisaLogging
LisaLogging.setup()
"""
Explanation: Trace Analysis Examples
Kernel Functions Profiling
Details on functions profiling are given in Plot Functions Profiling Data below.
End of explanation
"""
# Generate plots inline
%matplotlib inline
import json
import os
# Support to a... |
jseabold/statsmodels | examples/notebooks/recursive_ls.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
np.set_printoptions(suppress=True)
"""
Explanation: Recursive least squares
Recursive least squares is an expanding window version of ordinary least squa... |
ahwillia/RecNetLearn | tutorials/FORCE_Learning.ipynb | mit | from __future__ import division
from scipy.integrate import odeint,ode
from numpy import zeros,ones,eye,tanh,dot,outer,sqrt,linspace,cos,pi,hstack
from numpy.random import uniform,normal,choice
import pylab as plt
import numpy as np
%matplotlib inline
"""
Explanation: FORCE Learning Tutorial
Exercises by: Larry Abbott... |
xgcm/xmitgcm | doc/demo_read_input_grid.ipynb | mit | #We're going to download a sample grid from figshare
!wget https://ndownloader.figshare.com/files/14072594
!tar -xf 14072594
import xmitgcm
# We generate the extra metadata needed for multi-faceted grids
llc90_extra_metadata = xmitgcm.utils.get_extra_metadata(domain='llc', nx=90)
# Then we read the grid from the inp... |
mne-tools/mne-tools.github.io | 0.14/_downloads/plot_make_inverse_operator.ipynb | bsd-3-clause | # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License: BSD (3-clause)
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.minimum_norm import (make_inverse_operator, apply_inverse,
write_inverse_operator)
print(__doc__)
data_... |
pligor/predicting-future-product-prices | 04_time_series_prediction/07_price_history_varlen_rnn_cells.ipynb | agpl-3.0 | from __future__ import division
import tensorflow as tf
from os import path
import numpy as np
import pandas as pd
import csv
from sklearn.model_selection import StratifiedShuffleSplit
from time import time
from matplotlib import pyplot as plt
import seaborn as sns
from mylibs.jupyter_notebook_helper import show_graph
... |
ThunderShiviah/code_guild | interactive-coding-challenges/sorting_searching/selection_sort/selection_sort_challenge.ipynb | mit | def selection_sort(data, start=0):
# TODO: Implement me (recursive)
pass
def selection_sort_iterative(data):
# TODO: Implement me (iterative)
pass
"""
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem: Implem... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.