repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/launching_into_ml/labs/automl_text_classification.ipynb | apache-2.0 | # Setup your dependencies
import os
# The Google Cloud Notebook product has specific requirements
IS_GOOGLE_CLOUD_NOTEBOOK = os.path.exists("/opt/deeplearning/metadata/env_version")
# Google Cloud Notebook requires dependencies to be installed with '--user'
USER_FLAG = ""
if IS_GOOGLE_CLOUD_NOTEBOOK:
USER_FLAG = ... |
RaspberryJamBe/ipython-notebooks | notebooks/nl-be/101 - Intro - Python leren kennen en IPython gebruiken.ipynb | cc0-1.0 | 5+11
"""
Explanation: Hm, zullen we maar beginnen?
Deze applicatie heet IPython en je kan er Python code mee uitvoeren (Python is een soort programmeertaal; een manier om aan een computer uit te leggen wat die computer voor jou moet doen).
Selecteer de cel met de som hieronder door erin te klikken (er komt dan een gro... |
jamesorr/CO2SYS-MATLAB | notebooks/CO2SYS-Matlab_errors.ipynb | mit | %load_ext oct2py.ipython
"""
Explanation: Propagate uncertainties with the errors add-on for CO2SYS-Matlab
James Orr<br>
<img align="left" width="50%" src="http://www.lsce.ipsl.fr/Css/img/banniere_LSCE_75.png"><br><br>
LSCE/IPSL, CEA-CNRS-UVSQ, Gif-sur-Yvette, France
27 February 2018 <br><br>
updated: 29 June 2020
Ab... |
JAmarel/Phys202 | Midterm/AlgorithmsEx03.ipynb | mit | %matplotlib inline
from matplotlib import pyplot as plt
import numpy as np
from IPython.html.widgets import interact
"""
Explanation: Algorithms Exercise 3
Imports
End of explanation
"""
def char_probs(s):
"""Find the probabilities of the unique characters in the string s.
Parameters
----------
... |
iptrha/ml_techbier | machine_learning_aufgaben.ipynb | mit | import numpy as np
import matplotlib.pyplot as plt
import pylab
pylab.rcParams['figure.figsize'] = (13.0, 8.0)
%matplotlib inline
import pickle
import sklearn
import sklearn.linear_model
import sklearn.preprocessing
import sklearn.gaussian_process
import sklearn.ensemble
# to make the code is compatible with python... |
tensorflow/workshops | blog/TFX_Pipeline_for_BERT_Preprocessing_wo_tf_Examples.ipynb | apache-2.0 | try:
import colab
!pip install --upgrade pip
except:
pass
!pip install -Uq tfx==0.25.0
!pip install -Uq tensorflow-text # The tf-text version needs to match the tf version
print("Restart your runtime enable after installing the packages")
"""
Explanation: Copyright © 2020 The TensorFlow Authors.
Li... |
linsalrob/PyFBA | iPythonNotebooks/Using_an_SBML_model.ipynb | mit | import sys
import os
import copy
import PyFBA
import pickle
"""
Explanation: Using an SBML model
Getting started
Installing libraries
Before you start, you will need to install a couple of libraries:
The ModelSeedDatabase has all the biochemistry we'll need. You can install that with git clone.
The PyFBA library has d... |
nick-youngblut/SIPSim | ipynb/bac_genome/fullCyc/.ipynb_checkpoints/dataset_info-checkpoint.ipynb | mit | %load_ext rpy2.ipython
%%R
workDir = '/home/nick/notebook/SIPSim/dev/fullCyc/'
physeqDir = '/home/nick/notebook/fullCyc/data/MiSeq_16S/515f-806r/V4_Lib1-7/phyloseq/'
physeqBulkCore = 'bulk-core'
physeqSIP = 'SIP-core_unk'
"""
Explanation: General info on the fullCyc dataset (as it pertains to SIPSim validation)
Sim... |
mathnathan/notebooks | dissertation/Notes on Stochastic Approximation.ipynb | mit | import matplotlib.pyplot as plt
%matplotlib inline
from ipywidgets import interactive
import numpy as np
np.random.seed(12)
def f(x):
return np.sin(x)
true_root = np.pi
approx_root = np.pi/2 -1
x_vals = np.linspace(-np.pi/4, 2*np.pi+np.pi/4, 200)
f_vals = f(x_vals)
def draw(i=0):
global approx_root
fi... |
gwaygenomics/pancancer | scripts/tp53_ddr_cancertype_subtypes.ipynb | bsd-3-clause | import os
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
plt.style.use('seaborn-notebook')
sns.set(style='white')
sns.set_context('paper', rc={'font.size':16, 'axes.titlesize':11, 'axes.labelsize':20,
'xtick.labelsize':18, 'ytick.labelsize':14... |
INM-6/Python-Module-of-the-Week | session40_icecream/PyMotW - IceCream.ipynb | mit | def foo(i):
return i + 333
print(foo(123))
"""
Explanation: PyMotW - IceCream
<h1 align="center">
<img src="https://github.com/gruns/icecream/raw/master/logo.svg" width="220px" height="370px" alt="icecream">
</h1>
https://github.com/gruns/icecream
available via conda-forge and pypi
Never use print() to debug a... |
pycam/python-functions-and-modules | python_fm_2.ipynb | unlicense | x = abs(-3.0)
print(x)
l = len("ACGGTGTCAA")
print(l)
"""
Explanation: Working with Python: functions and modules
Session 2: Functions
Function definition syntax
Exercise 2.1
Return value
Exercise 2.2
Function arguments
Variable scope
Exercise 2.3
Function basics
We have already seen a number of functions built int... |
ES-DOC/esdoc-jupyterhub | notebooks/fio-ronm/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'fio-ronm', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: FIO-RONM
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Em... |
jdvelasq/ingenieria-economica | 10-marr.ipynb | mit | # Importa la librería financiera.
# Solo es necesario ejecutar la importación una sola vez.
import cashflows as cf
"""
Explanation: Tasa atractiva mínima (MARR)
Juan David Velásquez Henao
jdvelasq@unal.edu.co
Universidad Nacional de Colombia, Sede Medellín
Facultad de Minas
Medellín, Colombia
Haga click aquí para ac... |
joommf/tutorial | workshops/2017-03-19-DPG/micromagnetics.ipynb | bsd-3-clause | %matplotlib inline
import oommfc as oc
import discretisedfield as df
"""
Explanation: Micromagnetics basics with J-OOMMF
In this tutorial, we introduce basic concepts of computational micromagnetics using Python interface for OOMMF in Jupyter notebook (J-OOMMF).
Magnetic energies
The basic building block of any magnet... |
jamesfolberth/NGC_STEM_camp_AWS | notebooks/data8_notebooks/lab08/lab08.ipynb | bsd-3-clause | # Run this cell, but please don't change it.
# These lines import the Numpy and Datascience modules.
import numpy as np
from datascience import *
# These lines do some fancy plotting magic
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
import warnings
warnings.si... |
ES-DOC/esdoc-jupyterhub | notebooks/mpi-m/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', 'mpi-m', 'sandbox-2', 'land')
"""
Explanation: ES-DOC CMIP6 Model Properties - Land
MIP Era: CMIP6
Institute: MPI-M
Source ID: SANDBOX-2
Topic: Land
Sub-Topics: Soil, Snow, Vegetation, Energy Bal... |
StevenCHowell/code_sas_modeling | notebooks/python class demonstration.ipynb | gpl-3.0 | import datetime
import time
"""
Explanation: Classes and Object-Oriented Programming in Python
Here I demonstrate several key features of classes and object-oriented programming in Python. These include the following
- class inheritance
- overriding magic methods
- property setters and getters (using @property and @&... |
louridas/rwa | content/notebooks/chapter_04.ipynb | bsd-2-clause | import io
def caesar_cipher(plaintext, shift):
ciphertext = [ chr((ord(c) - ord('A') + shift) % 26 + ord('A'))
for c in plaintext ]
return ''.join(ciphertext)
ciphertext = caesar_cipher('IAMSEATEDINANOFFICE', 5)
print(ciphertext)
"""
Explanation: Secrets
Chapter 4 of Real World Algorit... |
NEONInc/NEON-Data-Skills | code/Python/uncertainty/hyperspectral-validation.ipynb | gpl-2.0 | import h5py
import csv
import numpy as np
import os
import gdal
import matplotlib.pyplot as plt
import sys
from math import floor
import time
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
"""
Explanation: Spectrometer accuracy assesment using validation tarps
Background
In this lesson we will be... |
metpy/MetPy | v0.9/_downloads/e8749c670d85c7ee86146b51f47ef020/unit_tutorial.ipynb | bsd-3-clause | import numpy as np
from metpy.units import units
"""
Explanation: Units Tutorial
Early in our scientific careers we all learn about the importance of paying
attention to units in our calculations. Unit conversions can still get the best
of us and have caused more than one major technical disaster, including the
crash... |
nehal96/Deep-Learning-ND-Exercises | TensorBoard/Anna KaRNNa Summaries.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
mayank-johri/LearnSeleniumUsingPython | Section 1 - Core Python/Chapter 14 - Properties/property.ipynb | gpl-3.0 | CONST = 10 # some constant
class Weather_balloon():
temp = 222
def convert_temp_to_f(self):
return self.temp * CONST
w = Weather_balloon()
w.temp = 122
print(w.convert_temp_to_f())
class Circle():
area = None
radius = None
def __init__(self, radius):
self.radius = radius
... |
GoogleCloudPlatform/ai-platform-samples | notebooks/samples/pytorch/lightning/TrainingAndPredictionWithPyTorchLightning.ipynb | apache-2.0 | # !gcloud compute tpus list --zone=YOUR_ZONE_HERE_SUCH_AS_us-central1-b
"""
Explanation: PyTorch Lightning Training
This notebook trains a model to predict whether the given sonar signals are bouncing off a metal cylinder or off a cylindrical rock from UCI Machine Learning Repository.
This notebook is derived from the... |
jcrist/pydy | examples/mass_spring_damper/mass_spring_damper.ipynb | bsd-3-clause | from IPython.display import SVG
SVG(filename='mass_spring_damper.svg')
"""
Explanation: Defining the Problem
Here we will derive the equations of motion for the classic mass-spring-damper system under the influence of gravity. The following figure gives a pictorial description of the problem.
End of explanation
"""
... |
angelmtenor/deep-learning | tensorboard/Anna_KaRNNa_Name_Scoped.ipynb | mit | import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
"""
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network is base... |
quantumlib/Cirq | docs/tutorials/google/colab.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... |
dandtaylor/MetroShare | initial_metro_delay_testing.ipynb | mit | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from geopy.geocoders import Nominatim
from geopy.distance import vincenty
from __future__ import division
import pickle
matplotlib.style.use('ggplot')
%matplotlib inline
"""
Explanation: In this notebook I do some initial data exploration with the m... |
mkcor/data-wrangling | tidy_data.ipynb | cc0-1.0 | import pandas as pd
"""
Explanation: Tidy data with Pandas
References
https://github.com/jakevdp/PythonDataScienceHandbook
https://github.com/hadley/r4ds/blob/master/tidy.Rmd
https://www.jstatsoft.org/article/view/v059i10/
End of explanation
"""
data = pd.read_csv('data/TB_notifications_2016-12-18.csv')
data.... |
dianafprieto/SS_2017 | 05_NB_Exercise.ipynb | mit | import vtk
#help(vtk.vtkRectilinearGridReader())
rectGridReader = vtk.vtkRectilinearGridReader()
rectGridReader.SetFileName("data/jet4_0.500.vtk")
# do not forget to call "Update()" at the end of the reader
rectGridReader.Update()
rectGridOutline = vtk.vtkRectilinearGridOutlineFilter()
rectGridOutline.SetInputData(re... |
ubc-library/code4lib-full-text-downloading-and-analysis | python_notebooks/1. Introduction.ipynb | mit | import json
import requests
apiResponse = requests.get('https://oc-index.library.ubc.ca/collections/bcbooks/items/1.0059569').json()
item = apiResponse['data']
fullText = item['FullText'][0]['value']
print(fullText)
"""
Explanation: Introduction to Python Jupyter
Welcome to Jupyter, through this interface I will be s... |
rsepassi/tensor2tensor | tensor2tensor/visualization/TransformerVisualization.ipynb | apache-2.0 | import os
import tensorflow as tf
from tensor2tensor import problems
from tensor2tensor.bin import t2t_decoder # To register the hparams set
from tensor2tensor.utils import registry
from tensor2tensor.utils import trainer_lib
from tensor2tensor.visualization import attention
from tensor2tensor.visualization import v... |
linamnt/studyGroup | lessons/python/pandas/Pandas Intro.ipynb | apache-2.0 | import pandas as pd
import numpy as np
blank = pd.DataFrame()
blank
movies = pd.DataFrame(np.zeros((4,4)), index=['Forrest Gump', 'Scanners', '2010: Odyssey Two', 'Fern Gully'], columns = ['Date Released', 'Box Office Gross', 'IMDB Score', 'Tomatometer'])
movies
zeros = pd.DataFrame(np.zeros((3,5)))
zeros
"""
Ex... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/introduction_to_tensorflow/labs/basic_intro_logistic_regression.ipynb | apache-2.0 | !sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
# Ensure the right version of Tensorflow is installed.
!pip freeze | grep tensorflow==2.1 || pip install tensorflow==2.1
"""
Explanation: Basic Introduction to Logistic Regression
Learning Objectives
Build a model
Train this model on example data
Use... |
mit-eicu/eicu-code | notebooks/medication.ipynb | mit | # Import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import psycopg2
import getpass
import pdvega
# for configuring connection
from configobj import ConfigObj
import os
%matplotlib inline
# Create a database connection using settings from config file
config='../db/config.ini'
#... |
crystalzhaizhai/cs207_yi_zhai | lectures/L11/L11.ipynb | mit | import xml.etree.ElementTree as ET
tree = ET.parse('shelterdogs.xml')
dogshelter = tree.getroot()
print(dogshelter)
print(dogshelter.tag)
print(dogshelter.attrib)
"""
Explanation: Lecture 11
Input File Interlude
Wednesday, October 11th 2017
Input Files and Parsing
We usually want to read data into our software:
* In... |
GoogleCloudPlatform/asl-ml-immersion | notebooks/time_series_prediction/solutions/2_optional_feature_engineering.ipynb | apache-2.0 | PROJECT = !(gcloud config get-value core/project)
PROJECT = PROJECT[0]
import pandas as pd
from google.cloud import bigquery
from IPython import get_ipython
from IPython.core.magic import register_cell_magic
bq = bigquery.Client(project=PROJECT)
# Allow you to easily have Python variables in SQL query.
@register_cel... |
flohorovicic/pynoddy | docs/notebooks/Gippsland-drillhole-uncertainty.ipynb | gpl-2.0 | from IPython.core.display import HTML
css_file = 'pynoddy.css'
HTML(open(css_file, "r").read())
%matplotlib inline
# here the usual imports. If any of the imports fails, make sure that pynoddy is installed
# properly, ideally with 'python setup.py develop' or 'python setup.py install'
import sys, os
import matplotlib... |
AtmaMani/pyChakras | islr/verifying_clt_in_regression.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
"""
Explanation: Verifying Central Limit Theorem in regression
End of explanation
"""
rand_1kx = np.random.randint(0,100,1000)
x_mean = np.mean(rand_1kx)
x... |
RaRe-Technologies/gensim | docs/notebooks/dtm_example.ipynb | lgpl-2.1 | import logging
import os
from gensim import corpora, utils
from gensim.models.wrappers.dtmmodel import DtmModel
import numpy as np
if not os.environ.get('DTM_PATH', None):
raise ValueError("SKIP: You need to set the DTM path")
"""
Explanation: DTM Example
In this example we will present a sample usage of the DTM ... |
4dsolutions/Python5 | Supermarket_Story.ipynb | mit | class Inventory:
"""
Supermarket brings an Inventory instance on board upon
initialization, increments / decrements items, reads
and writes to json file. Does not track cash.
"""
def __init__(self, the_file):
self.storage = the_file
with open(the_file, 'r') as warehouse:
... |
qutip/qutip-notebooks | examples/cqed-model.ipynb | lgpl-3.0 | %matplotlib inline
import numpy as np
from qutip import *
from qutip.qip.models.circuitprocessor import *
from qutip.qip.models.cqed import *
"""
Explanation: QuTiP example: Physical implementation of Cavity-Qubit model
Author: Anubhav Vardhan (anubhavvardhan@gmail.com)
For more information about QuTiP see http://... |
ES-DOC/esdoc-jupyterhub | notebooks/ncar/cmip6/models/sandbox-2/atmoschem.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncar', 'sandbox-2', 'atmoschem')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmoschem
MIP Era: CMIP6
Institute: NCAR
Source ID: SANDBOX-2
Topic: Atmoschem
Sub-Topics: Transport, Emissions ... |
IS-ENES-Data/submission_forms | dkrz_forms/Templates/Forms/Doc/Workflow_Provenance.ipynb | apache-2.0 | from IPython.display import display, Image
Image(filename='../../key-concepts.png')
# provide the file location of your form json file
# as a result a provenance graph is built based on a predefined workflow template
from dkrz_forms import utils
prov_graph = utils.gen_prov_graph('/opt/jupyter/notebooks/form_directory/... |
ud3sh/coursework | deeplearning.ai/coursera-neural-networks-and-deep-learning/week3-planar-data-classification-with-one-hidden-layer/Planar+data+classification+with+one+hidden+layer+v5.ipynb | unlicense | # Package imports
import numpy as np
import matplotlib.pyplot as plt
from testCases_v2 import *
import sklearn
import sklearn.datasets
import sklearn.linear_model
from planar_utils import plot_decision_boundary, sigmoid, load_planar_dataset, load_extra_datasets
%matplotlib inline
np.random.seed(1) # set a seed so tha... |
keras-team/keras-io | examples/vision/ipynb/swin_transformers.ipynb | apache-2.0 | !pip install -U tensorflow-addons
"""
Explanation: Image classification with Swin Transformers
Author: Rishit Dagli<br>
Date created: 2021/09/08<br>
Last modified: 2021/09/08<br>
Description: Image classification using Swin Transformers, a general-purpose backbone for computer vision.
This example implements Swin Tran... |
MelroLeandro/Matematica-Discreta-para-Hackers | jpynb_source/Chapter1_Introducao/.ipynb_checkpoints/Chapter1-checkpoint.ipynb | gpl-2.0 | 2+2
"""
Explanation: Matemática Discreta para Hackers
Version 0.1
Bem vindo a Matemática Discreta para Hackers. O repositório Github está desponivel em github/Matematica-Discreta-e-Programacao-Usando-Python. Esperamos que goste deste livro, e encorajamos que contribuira na sua melhoria!
Capítulo 1
Python
A linguagem... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session03/Day1/TestingandCI_solutions.ipynb | mit | !conda install pytest pytest-cov
"""
Explanation: Code Testing and CI
Version 0.1
The notebook contains problems about code testing and continuous integration.
E Tollerud (STScI)
Problem 1: Set up py.test in you repo
In this problem we'll aim to get the py.test testing framework up and running in the code repository ... |
drakero/Electron_Spectrometer | Photon_Diffusion/Photon_Diffusion.ipynb | mit | #Imports
from numpy import *
import matplotlib as mpl
import matplotlib.pyplot as plt
from scipy.integrate import quad
from scipy.special import erf
import sys
import os
#Import custom modules
sys.path.append('/home/drake/Documents/Physics/Research/Python/Modules')
from physics import *
%matplotlib notebook
"""
Expl... |
cdawei/flickr-photo | src/dataset_Melb.ipynb | gpl-2.0 | % matplotlib inline
import os, sys, time, pickle, tempfile
import math, random, itertools
import pandas as pd
import numpy as np
from joblib import Parallel, delayed
from scipy.misc import logsumexp
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
from... |
chayapan/pyfolio | pyfolio/examples/single_stock_example.ipynb | apache-2.0 | import pyfolio as pf
%matplotlib inline
# silence warnings
import warnings
warnings.filterwarnings('ignore')
"""
Explanation: Single stock analysis example in pyfolio
Here's a simple example where we produce a set of plots, called a tear sheet, for a single stock.
Import pyfolio and matplotlib
End of explanation
"""
... |
FunOnTheUpfield/DataVicGovAuPTDataCleaner | TrainStationEntries_DataCleaner.ipynb | gpl-3.0 | rawtrain = './raw/Train Station Entries 2008-09 to 2011-12 - data.XLS'
"""
Explanation: Train Station Data Cleaner
Data source
https://www.data.vic.gov.au/data/dataset/train-station-entries-2008-09-to-2011-12-new
Data Temporal Coverage: 01/07/2008 to 30/06/2012
Comparable data with buses and trams [Weekeday by time 'A... |
masve/saav-deliveries | project/Weather Data.ipynb | mit | import pandas as pd
import numpy as np
import datetime
from datetime import date
from dateutil.rrule import rrule, DAILY
from __future__ import division
import geoplotlib as glp
from geoplotlib.utils import BoundingBox, DataAccessObject
pd.set_option('display.max_columns', None)
%matplotlib inline
"""
Explanation: ... |
francisc0garcia/autonomous_bicycle | docs/python_notebooks/EKF_with_sigma_model.ipynb | apache-2.0 | # Import dependencies
from __future__ import division, print_function
%matplotlib inline
import scipy
import sympy
from sympy import Symbol, symbols, Matrix, sin, cos, latex
from sympy.interactive import printing
printing.init_printing()
sympy.init_printing(use_latex="mathjax", fontsize='16pt')
from BicycleTrajectory... |
pligor/predicting-future-product-prices | 02_preprocessing/exploration00_features_vs_price_for_regression_potential.ipynb | agpl-3.0 | orig_df = pd.read_csv('../mobiles_01_preprocessed.csv', index_col=0, encoding='utf-8', quoting=csv.QUOTE_ALL)
df = orig_df.drop(
labels=SkroutzMobile.TEMP_DROP_COLS, axis=1
)
df_norm_with_outliers = df.copy(deep=True)
ss = StandardScaler()
df_norm_with_outliers[df.columns] = ss.fit_transform(df[df.columns])
df... |
ES-DOC/esdoc-jupyterhub | notebooks/miroc/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', 'miroc', 'sandbox-1', 'seaice')
"""
Explanation: ES-DOC CMIP6 Model Properties - Seaice
MIP Era: CMIP6
Institute: MIROC
Source ID: SANDBOX-1
Topic: Seaice
Sub-Topics: Dynamics, Thermodynamics, Ra... |
mohsinhaider/pythonbootcampacm | Object Oriented Programming/Object-Oriented Programming.ipynb | mit | # Creating a class called Bike
class Bike:
pass
"""
Explanation: Object-Oriented Programming
We've talked about how everyting in Python is an object. In addition, we've come to use many objects. However, we have not created any objects. In this lecture, we will discuss object-oriented programming, and what we can ... |
jhseu/tensorflow | tensorflow/lite/micro/examples/magic_wand/train/train_magic_wand_model.ipynb | apache-2.0 | %tensorflow_version 2.x
"""
Explanation: Train a gesture recognition model for microcontroller use
This notebook demonstrates how to train a 20kb gesture recognition model for TensorFlow Lite for Microcontrollers. It will produce the same model used in the magic_wand example application.
The model is designed to be u... |
elsdrm/shared_note | MATLAB_Examples.ipynb | mit | import pymatbridge as pymat
ip = get_ipython()
pymat.load_ipython_extension(ip,
matlab='C:\Users\Andrey\matlab_shortcut.lnk')
"""
Explanation: Running MATLAB in an IPython Notebook
With Interactive MATLAB Graphing in Plotly
Check out more examples interactive Plotly graphs in IPython notebooks here: nbviewer.ipyt... |
Benedicto/ML-Learning | Classifier_2_logistic_regression_with_L2.ipynb | gpl-3.0 | from __future__ import division
import graphlab
"""
Explanation: Logistic Regression with L2 regularization
The goal of this second notebook is to implement your own logistic regression classifier with L2 regularization. You will do the following:
Extract features from Amazon product reviews.
Convert an SFrame into a... |
maxis42/ML-DA-Coursera-Yandex-MIPT | 4 Stats for data analysis/Lectures notebooks/14 regression/stat.regression.ipynb | mit | import statsmodels
import scipy as sc
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.stats.api as sms
from statsmodels.graphics.regressionplots import plot_leverage_resid2
import matplotlib.pyplot as plt
%pylab inline
"""
Explanation: Линейная регрессия
End of explanat... |
statsmaths/stat665 | lectures/lec21/notebook21.ipynb | gpl-2.0 | %pylab inline
import copy
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sys
import os
import re
from keras.datasets import imdb, reuters
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.optimizers import SGD, RMSprop
from... |
tschinz/iPython_Workspace | 01_Mine/Block Berechnungen.ipynb | gpl-2.0 |
def soil_calc(area, price_per_m2, members):
price_tot = area * price_per_m2
price_appartment = price_tot / members
print("{} m^2 @ {} SFr/m^2 = {} SFr ".format(area, price_per_m2, price_tot))
print("Price per Appartment if {} Appartments = {} SFr".format(members, int(price_appartment)))
print("{}% ... |
rvperry/phys202-2015-work | assignments/assignment03/NumpyEx04.ipynb | mit | import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
"""
Explanation: Numpy Exercise 4
Imports
End of explanation
"""
import networkx as nx
K_5=nx.complete_graph(5)
nx.draw(K_5)
"""
Explanation: Complete graph Laplacian
In discrete mathematics a Graph is a set of vertices or n... |
ktaneishi/deepchem | examples/notebooks/seqtoseq_fingerprint.ipynb | mit | import deepchem as dc
tasks, datasets, transformers = dc.molnet.load_muv()
train_dataset, valid_dataset, test_dataset = datasets
train_smiles = train_dataset.ids
valid_smiles = valid_dataset.ids
"""
Explanation: SeqToSeq Fingerprint
In this example, we will use a SeqToSeq model to generate fingerprints for classifying... |
TeamProgramming/ITYM | 7ex/math.ipynb | mit | import numpy as np
from numpy.linalg import *
rg = matrix_rank
from IPython.display import display, Math, Latex, Markdown
from sympy import *
pr = lambda s: display(Markdown('$'+str(latex(s))+'$'))
def pmatrix(a, intro='',ending='',row=False):
if len(a.shape) > 2:
raise ValueError('pmatrix can at most d... |
abevieiramota/data-science-cookbook | 2016/knn/knn.ipynb | mit | from sklearn.neighbors import KNeighborsClassifier
import numpy as np
import math
data = np.loadtxt("haberman.data",delimiter=",")
print(data)
"""
Explanation: KNN
Algumas execuções usando scikit-learn
Vamos utilizar a implementação da biblioteca K-Nearest Neighbors para descobrir qual o melhor K para o nosso dataset... |
SteveDiamond/cvxpy | examples/notebooks/WWW/fault_detection.ipynb | gpl-3.0 | import numpy as np
import matplotlib.pyplot as plt
np.random.seed(1)
n = 2000
m = 200
p = 0.01
snr = 5
sigma = np.sqrt(p*n/(snr**2))
A = np.random.randn(m,n)
x_true = (np.random.rand(n) <= p).astype(np.int)
v = sigma*np.random.randn(m)
y = A.dot(x_true) + v
"""
Explanation: Fault detection
We'll consider a proble... |
Ciaran1981/geospatial-learn | example_notebooks/Change_detection.ipynb | gpl-3.0 | %matplotlib inline
"""
Explanation: The following notebook is a tutorial on machine learning to detect change using geospatial_learn
Documentation on the lib can be found here:
http://geospatial-learn.readthedocs.io/en/latest/
Please use QGIS to visualise results as this is quicker than plotting them in the notebook.... |
landlab/landlab | notebooks/tutorials/terrain_analysis/drainage_density/drainage_density.ipynb | mit | import copy
import numpy as np
import matplotlib as mpl
from landlab import RasterModelGrid, imshow_grid
from landlab.io import read_esri_ascii
from landlab.components import FlowAccumulator, DrainageDensity
"""
Explanation: <a href="http://landlab.github.io"><img style="float: left" src="../../../landlab_header.png">... |
fluffy-hamster/A-Beginners-Guide-to-Python | A Beginners Guide to Python/22. Common Error Messages.ipynb | mit | 3ds = 100 # cannot start names with numbers. To fix: three_d_s = 100, or nintendo3ds = 100
list = [1,2,3] # "list" is a special keyword in Python, cannot use it as a name. To fix: a_list = [1,2,3]
"""
Explanation: Common Error Messages
Hi guys, in this lecture we shall be looking at a couple of Python's error message... |
steinam/teacher | jup_notebooks/datenbanken/Nordwind_11FI3_On_Paper.ipynb | mit | %load_ext sql
%sql mysql://steinam:steinam@localhost/versicherung_complete
"""
Explanation: Versicherung on Paper
End of explanation
"""
%%sql
-- meine Lösung
select distinct(Land) from Fahrzeughersteller;
%%sql
-- deine Lösung
SELECT DISTINCT Land
FROM fahrzeughersteller
"""
Explanation: Gesucht wird eine wie... |
xianjunzhengbackup/code | data science/regression.ipynb | mit | from azureml import Workspace
ws = Workspace(
workspace_id='3c64d445b4c840dca9683dd47522eba3',
authorization_token='JaC5E2q5FouX14JhvCmcvmzagqV63q0oVIbu2jblLBdQ5e5wf/Y24Ed6uXLvbSUgbiao5iF85C3uufYKQgXoNw==',
endpoint='https://studioapi.azureml.net'
)
ds = ws.datasets['boston.csv']
df = ds.to_dataframe()
df.... |
me-surrey/dl-gym | 14_recurrent_neural_networks.ipynb | apache-2.0 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
# to make this notebook's output stable across runs
def reset_graph(seed=42):
tf.reset_default_graph()
tf.set_random_seed(seed)
np.random.seed(seed)
# To... |
ML-KULeuven/socceraction | public-notebooks/1-load-and-convert-statsbomb-data.ipynb | mit | import os
import warnings
import pandas as pd
pd.set_option('display.max_columns', None)
warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning)
warnings.filterwarnings(action="ignore", message="credentials were not supplied. open data access only")
import tqdm
%load_ext autoreload
%autoreload 2
... |
TimothyHelton/k2datascience | notebooks/EDA_MTA_Exercises.ipynb | bsd-3-clause | from collections import defaultdict
import csv
import os
import os.path as osp
from dateutil.parser import parse
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from k2datascience import nyc_mta
from IPython.core.interactiveshell import InteractiveShell
Int... |
yhat/ggplot | docs/how-to/Plotting two variables as lines on the same graph.ipynb | bsd-2-clause | meat_subset = meat[['date', 'beef', 'pork']]
df = pd.melt(meat_subset, id_vars=['date'])
df.head()
"""
Explanation: Plotting two variables as lines on the same graph
So you've got 2 variables and you want to plot them on the same chart? How do you do it in ggplot? Well good news is it's super easy to do with ggplot!
W... |
csaladenes/csaladenes.github.io | test/eis-metadata-validation/Planon metadata validation5.ipynb | mit | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
"""
Explanation: EIS metadata validation script
Used to validate Planon output with spreadsheet input
1. Data import
End of explanation
"""
planon=pd.read_excel('EIS Assets v2.xlsx',index_col = 'Code')
master_loggerscontrollers... |
Kaggle/learntools | notebooks/game_ai/raw/ex2.ipynb | apache-2.0 | from learntools.core import binder
binder.bind(globals())
from learntools.game_ai.ex2 import *
"""
Explanation: Introduction
In the tutorial, you learned how to define a simple heuristic that the agent used to select moves. In this exercise, you'll check your understanding and make the heuristic more complex.
To get ... |
paolorivas/homeworkfoundations | homeworkdata/Homework_5_Paolo_Rivas_Legua.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: Homework #5
This homework presents a sophisticated scenario in which you must design a SQL schema, insert data into it, an... |
663project/fastica_lz | Independent_Component_Analysis.ipynb | mit | # %load Source/fastICA_0.py
import numpy as np
from sklearn import preprocessing
def sym_decorrelation(W):
""" Symmetric decorrelation """
K = np.dot(W, W.T)
s, u = np.linalg.eigh(K)
W = (u @ np.diag(1.0/np.sqrt(s)) @ u.T) @ W
return W
def g_logcosh(wx,alpha):
"""derivatives of logcosh"""
... |
elenduuche/deep-learning | weight-initialization/weight_initialization.ipynb | mit | %matplotlib inline
import tensorflow as tf
import helper
from tensorflow.examples.tutorials.mnist import input_data
print('Getting MNIST Dataset...')
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
print('Data Extracted.')
"""
Explanation: Weight Initialization
In this lesson, you'll learn how to fin... |
google-research/big_transfer | colabs/big_transfer_pytorch.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# 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 ap... |
dnxbjyj/python-basic | char-code/python_char_code_problems.ipynb | mit | # coding:utf-8
"""
Explanation: 专治各种python字符编码问题疑难杂症
积累对于python中和字符编码相关问题的疑难杂症及解决方案。
标准动作
在脚本第一行指定编码格式:
End of explanation
"""
import sys
sys.getdefaultencoding()
reload(sys)
sys.setdefaultencoding('utf-8')
"""
Explanation: 将默认的ascii字符流处理方式变为utf-8:
End of explanation
"""
from chardet import detect
detect('abc'... |
mcamack/Jupyter-Notebooks | NLP/NLP - Harry Potter Generator.ipynb | apache-2.0 | # http://www.glozman.com/textpages.html
# Harry Potter 1 - Sorcerer's Stone.txt
# Harry Potter 2 - Chamber of Secrets.txt
# Harry Potter 3 - The Prisoner Of Azkaban.txt
# Harry Potter 4 - The Goblet Of Fire.txt
# Harry Potter 5 - Order of the Phoenix.txt
# Harry Potter 6 - The Half Blood Prince.txt
# Harry Potter ... |
shahrajat/DataMining | music-recommender/recommender.ipynb | gpl-2.0 | from pyspark.mllib.recommendation import *
import random
from operator import *
"""
Explanation: Music Recommender System using Apache Spark and Python
Estimated time: 8hrs
Description
For this project, you are to create a recommender system that will recommend new musical artists to a user based on their listening hi... |
tensorflow/docs-l10n | site/ko/federated/tutorials/tff_for_federated_learning_research_compression.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... |
ES-DOC/esdoc-jupyterhub | notebooks/cnrm-cerfacs/cmip6/models/cnrm-cm6-1-hr/aerosol.ipynb | gpl-3.0 | # DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cnrm-cerfacs', 'cnrm-cm6-1-hr', 'aerosol')
"""
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CNRM-CERFACS
Source ID: CNRM-CM6-1-HR
Topic: Aerosol
Sub-Topics: Tra... |
gaargly/gaargly.github.io | 2021_06_23_Lira_2ndAssignment_Tyler.ipynb | mit | import pandas as pd
flights = pd.read_csv('https://tf-assets-prod.s3.amazonaws.com/tf-curric/data-science/flights.csv')
airline = pd.read_csv('https://tf-assets-prod.s3.amazonaws.com/tf-curric/data-science/airlines.csv')
# codes here
nycflights13 = pd.merge(flights, airline, on="carrier")
"""
Explanation: <a href="h... |
tensorflow/docs-l10n | site/en-snapshot/agents/tutorials/10_checkpointer_policysaver_tutorial.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under... |
AllenDowney/ThinkBayes2 | soln/chap09.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... |
SteveDiamond/cvxpy | examples/notebooks/derivatives/fundamentals.ipynb | gpl-3.0 | import cvxpy as cp
x = cp.Variable(pos=True)
y = cp.Variable(pos=True)
z = cp.Variable(pos=True)
a = cp.Parameter(pos=True)
b = cp.Parameter(pos=True)
c = cp.Parameter()
objective_fn = 1/(x*y*z)
objective = cp.Minimize(objective_fn)
constraints = [a*(x*y + x*z + y*z) <= b, x >= y**c]
problem = cp.Problem(objective,... |
DistrictDataLabs/intro-to-nltk | Text.ipynb | mit | import codecs
import requests
from urlparse import urljoin
from contextlib import closing
chunk_size = 10**6 # Download 1 MB at a time.
wpurl = "http://wpo.st/" # Washington Post provides short links
def fetch_webpage(url, path):
# Open up a stream request (to download large documents)
# Ensure that we wil... |
tschinz/iPython_Workspace | 02_WP/Admin/example_py3/dplyr_pandas.ipynb | gpl-2.0 | #%load_ext rpy2.ipython
#%R install.packages("nycflights13", repos='http://cran.us.r-project.org')
#%R library(nycflights13)
#%R write.csv(flights, "flights.csv")
"""
Explanation: Tom Augspurger Dplyr/Pandas comparison (copy of 2016-01-01)
See result there
http://nbviewer.ipython.org/urls/gist.githubusercontent.com/To... |
dcavar/python-tutorial-for-ipython | notebooks/Backpropagation_Tutorial.ipynb | apache-2.0 | import numpy as np
"""
Explanation: Backpropagation Tutorial
(C) 2019 by Damir Cavar
Version: 0.1, November 2019
Download: This and various other Jupyter notebooks are available from my GitHub repo.
Introduction
For more details on Backpropagation and its use in Neural Networks see Rumelhart, Hinton, and Williams (198... |
bcantarel/bcantarel.github.io | bicf_nanocourses/courses/python_1/lectures/day_2/Day2-Lesson-3-Exercise1_key.ipynb | gpl-3.0 | maxNumber = 0
numberList = [15,4,26,1,9,21,3,6,13]
for each in numberList:
if each>maxNumber:
maxNumber = each
print("The largest number in the list is {0}".format(maxNumber))
"""
Explanation: Question 1:
For basic operation using list, tuple and dictionaries
1.1
a. Finds the largest of a list of numbers.
... |
rusucosmin/courses | ml/ex04/template/ex04.ipynb | mit | from helpers import load_data
# load dataset
x, y = load_data()
def build_k_indices(y, k_fold, seed):
"""build k indices for k-fold."""
num_row = y.shape[0]
interval = int(num_row / k_fold)
np.random.seed(seed)
indices = np.random.permutation(num_row)
k_indices = [indices[k * interval: (k + 1)... |
dronecrew/ulog_tools | notebooks/old/Discrete Control Design.ipynb | bsd-3-clause | def model_to_acc_tf(m):
# open loop, rate output, mix input plant
acc_tf = m['gain'] * control.tf(*control.pade(m['delay'], 1)) # order 1 approx
tf_integrator = control.tf((1), (1, 0))
return acc_tf * tf_integrator
def pid_design(G_rate_ol, d_tc=1.0/125, K0=[0.01, 0.01, 0.01, 5]):
K_rate, G_cl_rat... |
zambzamb/zpic | python/TwoStreamSpectral.ipynb | agpl-3.0 | import em1ds as zpic
import numpy as np
nx = 120
dt = 0.1
ppc = 500
ufl = [0.2, 0.0, 0.0]
uth = [0.001,0.001,0.001]
right = zpic.Species( "right", -1.0, ppc, ufl = ufl, uth = uth )
ufl[0] = -ufl[0]
left = zpic.Species( "left", -1.0, ppc, ufl = ufl, uth = uth )
sim = zpic.Simulation( nx, box = 4 * np.pi, dt = ... |
jhprinz/openpathsampling | examples/alanine_dipeptide_tps/AD_tps_3a_analysis_flex.ipynb | lgpl-2.1 | filename = "tps_nc_files/alanine_dipeptide_tps.nc"
# note that this log will overwrite the log from the previous notebook
#import logging.config
#logging.config.fileConfig("logging.conf", disable_existing_loggers=False)
%%time
flexible = paths.AnalysisStorage(filename)
engine = flexible.engines[0]
flex_scheme = flex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.