repo_name stringlengths 6 77 | path stringlengths 8 215 | license stringclasses 15
values | content stringlengths 335 154k |
|---|---|---|---|
rmsouza01/iamxt | jupyter-notebook/.ipynb_checkpoints/iamxt_getting_started-checkpoint.ipynb | bsd-2-clause | # This makes plots appear in the notebook
%matplotlib inline
import numpy as np # numpy is the major library in which siamxt was built upon
# we like the array programming style =)
# We are using PIL to read images
from PIL import Image
# and matplotlib to display images
import matplotlib.py... |
blua/deep-learning | language-translation/dlnd_language_translation.ipynb | mit | """
DON'T MODIFY ANYTHING IN THIS CELL
"""
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
"""
Explanation: Language Translation
In this project, you’re going... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/sdk/sdk_automl_text_entity_extraction_batch.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: AutoML training text entity extraction model for batch prediction
<table align="lef... |
iRipVanWinkle/ml | Data Science UA - September 2017/Lecture 07 - Simulation Modeling/Portfolio_Simulation_Modeling.ipynb | mit | import pandas as pd
import pandas.io.data as web
import matplotlib.pyplot as plt
import datetime as datetime
from numpy import *
%matplotlib inline
"""
Explanation: Portfolio Simulation Modeling
Download Data
Download S&P 500 index data from Yahoo Finance
End of explanation
"""
start_date = datetime.date(1976,1,1)
e... |
GoogleCloudPlatform/tensorflow-without-a-phd | tensorflow-rnn-tutorial/00_Keras_RNN_predictions_solution.ipynb | apache-2.0 | # using Tensorflow 2
%tensorflow_version 2.x
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
print("Tensorflow version: " + tf.__version__)
#@title Display utilities [RUN ME]
from enum import IntEnum
import numpy as np
class Waveforms(IntEnum):
SINE1 = 0
SINE2 = 1
SINE3 = ... |
UWSEDS/LectureNotes | Spring2019/04a_Exceptions_and_Testing/unit-tests.ipynb | bsd-2-clause | import numpy as np
# Code Under Test
def entropy(ps):
if any([(p < 0.0) or (p > 1.0) for p in ps]):
raise ValueError("Bad input.")
if sum(ps) > 1:
raise ValueError("Bad input.")
items = ps * np.log(ps)
new_items = []
for item in items:
if np.isnan(item):
new_items... |
bsautermeister/tensorlight | examples/runtime-mnist-cnn-autoencoder.ipynb | mit | # Force matplotlib to use inline rendering
%matplotlib inline
import os
import sys
# add path to libraries for ipython
sys.path.append(os.path.expanduser("~/libs"))
import numpy as np
import tensorflow as tf
import tensorlight as light
BATCH_SIZE = 64
WEIGHT_DECAY = 1e-8
INITIAL_LR = 0.01
DATA_ROOT = "data"
TRAIN_... |
melissawm/oceanobiopython | Notebooks/Aula_3.ipynb | gpl-3.0 | import os
diretorio = os.path.join(os.getcwd(), "..","exemplos/exemplo_2")
with open(os.path.join(diretorio,"file1.txt"), "r") as arquivo:
numlinhas = 0
for line in arquivo:
numlinhas += 1
print(numlinhas)
"""
Explanation: Leitura e Escrita em Arquivos
No Python, se quisermos abrir um arquivo ... |
paix120/DataScienceLearningClubActivities | Activity05/Mushroom Edibility Classification - Naive Bayes Bernoulli.ipynb | gpl-2.0 | #import pandas and numpy libraries
import pandas as pd
import numpy as np
import sys #sys needed only for python version
#import gaussian naive bayes from scikit-learn
import sklearn as sk
#seaborn for pretty plots
import seaborn as sns
#display versions of python and packages
print('\npython version ' + sys.version)
... |
Naereen/notebooks | simus/Calcul_d_une_paire_de_des_un_peu_particuliers.ipynb | mit | from sympy import isprime
from sympy import primerange
"""
Explanation: Calcul d'une paire de dés un peu particulière.
Je vais implémenter une fonction, en Python 3, qui permettra de résoudre rapidement un problème mathématique.
Exposé du problème :
Soit $n \geq 1$ un nombre de faces pour des dés bien équilibrés. ... |
TrinVeerasiri/presta_to_woo_migration | product.ipynb | gpl-3.0 | import pandas as pd
import numpy as np
"""
Explanation: Product migration from Prestashop to Woocommerce
This is the product migration of the book store from Prestashop to Woocommerce format.
Woocommerce has a function to import/export product. We will use this advantage by export the form of Woocommerce, merge with o... |
HazyResearch/snorkel | tutorials/workshop/Workshop_4_Discriminative_Model_Training.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import os
import numpy as np
# Connect to the database backend and initalize a Snorkel session
from lib.init import *
from snorkel.annotations import load_marginals
from snorkel.models import candidate_subclass
Spouse = candidate_subclass('Spouse', ['person1', 'pe... |
snowch/biginsight-examples | misc/WebHDFS_Example_local_storage.ipynb | apache-2.0 | # Cluster number, e.g. 100000
cluster = ''
# Cluster username
username = ''
# Cluster password
password = ''
# file path in HDFS
webhdfs_filepath = 'yourpath/yourfile.txt'
# where to save the file in the spark service file system
local_filepath = 'yourfile.txt'
"""
Explanation: NOTE: This notebook downloads file... |
iaja/scalaLDAvis | examples/python/Dirichlet distribution.ipynb | apache-2.0 |
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as tri
from functools import reduce
# import seaborn
from math import gamma
from operator import mul
corners = np.array([[0, 0], [1, 0], [0.5,0.75**0.5]])
print(corners)
triangle = tri.Triangulation(corners[:, 0], corners[:, 1... |
temmeand/scikit-rf | doc/source/tutorials/Media.ipynb | bsd-3-clause | %matplotlib inline
import skrf as rf
rf.stylely()
from skrf import Frequency
from skrf.media import CPW
freq = Frequency(75,110,101,'ghz')
cpw = CPW(freq, w=10e-6, s=5e-6, ep_r=10.6)
cpw
"""
Explanation: Media
Introduction
skrf supports some basic circuit simulation based on transmission line models. Network creati... |
1iyiwei/pyml | code/ch07/ch07.ipynb | mit | %load_ext watermark
%watermark -a '' -u -d -v -p numpy,pandas,matplotlib,scipy,sklearn
"""
Explanation: Copyright (c) 2015, 2016 Sebastian Raschka
<br>
2016 Li-Yi Wei
https://github.com/1iyiwei/pyml
MIT License
Python Machine Learning - Code Examples
Chapter 7 - Combining Different Models for Ensemble Learning
Note th... |
GoogleCloudPlatform/bigquery-notebooks | notebooks/community/analytics-componetized-patterns/retail/recommendation-system/bqml/bqml_retail_recommendation_system.ipynb | apache-2.0 | !pip install google-cloud-bigquery
# Automatically restart kernel after installs
import IPython
app = IPython.Application.instance()
app.kernel.do_shutdown(True)
"""
Explanation: <table align="left">
<td>
<a href="https://colab.research.google.com/github/GoogleCloudPlatform/analytics-componentized-patterns/blo... |
albireox/marvin | docs/sphinx/exercises/resolved_mass_metallicity_relation_SOLUTION.ipynb | bsd-3-clause | import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import os
from os.path import join
path_notebooks = os.path.abspath('.')
path_data = join(path_notebooks, 'data')
"""
Explanation: Spatially-Resolved Mass-Metallicity Relation
We're going to construct the spatially-resolved mass-metallicity relatio... |
tensorflow/probability | tensorflow_probability/examples/jupyter_notebooks/A_Tour_of_TensorFlow_Probability.ipynb | apache-2.0 | #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" }
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... |
ericjhilton/bike-share-ML | bikeShareHourly.ipynb | mit | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
hourly = pd.read_csv('Bike-Sharing-Dataset/hour.csv',header = 0)
hourly.head(20)
type(hourly)
for row_index, row in hourly.iterrows():
print row_index , row['registered']
if (row_index > 5):
break
weekly... |
gekaklam/presentation-testing | notebooks/01_navigation.ipynb | mit | print('hello world')
"""
Explanation: Navigating the Notebook
Let's get started...
Create a new notebook...
The notebook is built up from separate editable areas, or cells.
A new notebook contains a single code cell.
Add a line of code and execute it by:
- clicking the run button, or
- click in the cell, and press shi... |
graphistry/pygraphistry | demos/data/benchmarking/DenseDatasets.ipynb | bsd-3-clause | import random
import graphistry as g
import pandas as pd
"""
Explanation: Dense Datasets
This notebook is used for benchmarking and debugging sparse datasets
Import the necessary libaries
End of explanation
"""
g.__version__
# To specify Graphistry account & server, use:
# graphistry.register(api=3, username='...... |
JuanIgnacioGil/basket-stats | NBA_Keras/.ipynb_checkpoints/Predicting NBA players positions using Keras-checkpoint.ipynb | mit | %load_ext autoreload
%autoreload 2
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelBinarizer, StandardScaler
from keras.models import Sequential
from keras.layers import Dense, Activation, Dropout
"""
Explanation: Predicting NBA play... |
whitead/numerical_stats | unit_9/hw_2020/homework_9_key.ipynb | gpl-3.0 | import numpy as np
m = np.ones( (6,6) )
m[:,1] = 3
print(m)
"""
Explanation: Homework 9 Key
CHE 116: Numerical Methods and Statistics
4/2/2020
1. Creating Matrices (6 Points)
Create the following matrices using the given constraints. 2 Points each.
In 2 lines of python (not including prints/imports), create a 6x6 m... |
scieloorg/journals-catalog | jcatalog/extractors/scielo/td_documents_dates.ipynb | bsd-2-clause | from datetime import datetime
start = datetime.utcnow() # For measuring the total processing time
import json
from urllib.request import urlopen
import pandas as pd
import numpy as np
"""
Explanation: Dates pivot table
End of explanation
"""
AMC_URL = "http://articlemeta.scielo.org/api/v1/collection/identifiers/"
a... |
jbn/vaquero | demo/Inline_Demo.ipynb | mit | from vaquero import Vaquero, callables_from
"""
Explanation: This notebook demonstrates vaquero, as both a library and data cleaning pattern.
End of explanation
"""
lines = ["1, 1.0", # An errant float
"1, $", # A bad number
"1,-1", # A good line
"10"] # Missing the second valu... |
sraejones/phys202-2015-work | assignments/assignment10/ODEsEx01.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.integrate import odeint
from IPython.html.widgets import interact, fixed
"""
Explanation: Ordinary Differential Equations Exercise 1
Imports
End of explanation
"""
def solve_euler(derivs, y0, x):
"""Solve a 1d ... |
ProjectPyRhO/Prometheus | Prometheus.ipynb | bsd-3-clause | %matplotlib notebook
from pyrho import *
loadGUI()
"""
Explanation: <div class="clearfix" style="padding: 10px; padding-left: 0px">
<a href="https://github.com/ProjectPyRhO/PyRhO", target="_blank"><img src="https://raw.githubusercontent.com/ProjectPyRhO/Prometheus/master/resources/images/PyRhO_logo_H_crop.png" alt="P... |
ZwickyTransientFacility/simsurvey-examples | tutorial-macronova.ipynb | bsd-3-clause | import os
home_dir = os.environ.get('HOME')
# Please enter the filename of the ztf_sim output file you would like to use. The example first determines
# your home directory and then uses a relative path (useful if working on several machines with different usernames)
survey_file = os.path.join(home_dir, 'data/ZTF/test... |
brandoncgay/deep-learning | transfer-learning/Transfer_Learning.ipynb | mit | from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
vgg_dir = 'tensorflow_vgg/'
# Make sure vgg exists
if not isdir(vgg_dir):
raise Exception("VGG directory doesn't exist!")
class DLProgress(tqdm):
last_block = 0
def hook(self, block_num=1, block_size=1, total_s... |
cosmostatschool/MACSS2017 | Projects/mcmc/second_day_bis.ipynb | mit | import numpy as np
import scipy.integrate as integrate
def E(z,OmDE):
"""
This function computes the integrand for the computation of the luminosity distance for a flat universe
z -> float
OmDE -> float
gives
E -> float
"""
return 1/np.sqrt((1-OmDE)*(1+z)**3+OmDE)
def dl(z,OmDE,h=0.7):
... |
anodos-ru/catalog | updaters/categoriser.ipynb | mit | import os
import sys
from django.utils import timezone
sys.path.append('/home/ubuntu/anodos.ru/anodos/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'anodos.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
%matplotlib inline
import numpy as np
import pandas as pd
import se... |
macks22/gensim | docs/notebooks/Similarity_Queries.ipynb | lgpl-2.1 | import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
import os
import tempfile
TEMP_FOLDER = tempfile.gettempdir()
print('Folder "{}" will be used to save temporary dictionary and corpus.'.format(TEMP_FOLDER))
"""
Explanation: Similarity Queries
Don't forget to se... |
shogun-toolbox/shogun | doc/ipython-notebooks/classification/HashedDocDotFeatures.ipynb | bsd-3-clause | import os
import shogun as sg
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data')
"""
Explanation: Large scale document classification with the Shogun Machine Learning Toolbox
By Evangelos Anagnostopoulos (GitHub ID: <a href="http://githu... |
diegocavalca/Studies | programming/Python/tensorflow/exercises/Math_Part3.ipynb | cc0-1.0 | from __future__ import print_function
import tensorflow as tf
import numpy as np
from datetime import date
date.today()
author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises"
tf.__version__
np.__version__
sess = tf.InteractiveSession()
"""
Explanation: Math Part 3
End of explanation
"""
_X = np.a... |
ceos-seo/data_cube_notebooks | notebooks/legacy/Chunking_Demo_Notebook_WOFS.ipynb | apache-2.0 | import sys
import os
sys.path.append(os.environ.get('NOTEBOOK_ROOT'))
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
import warnings
import datacube
import utils.data_cube_utilities.data_access_api as dc_api
# Supress Warning
warnings.filterwarnings('ignore')
api = dc_api.DataAccessApi()... |
Kaggle/learntools | notebooks/time_series/raw/ex2.ipynb | apache-2.0 | # Setup feedback system
from learntools.core import binder
binder.bind(globals())
from learntools.time_series.ex2 import *
# Setup notebook
from pathlib import Path
from learntools.time_series.style import * # plot style settings
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn a... |
chengsoonong/crowdastro | notebooks/14_cnn.ipynb | mit | import collections
import io
from pprint import pprint
import sqlite3
import sys
import warnings
import astropy.io.votable
import astropy.wcs
import matplotlib.pyplot
import numpy
import requests
import requests_cache
import sklearn.cross_validation
%matplotlib inline
sys.path.insert(1, '..')
import crowdastro.data
... |
poser/python-data-mooc | ca-ballot-measures.ipynb | gpl-3.0 | import pandas as pd
# proposition = "PROPOSITION 064- MARIJUANA LEGALIZATION. INITIATIVE STATUTE."
proposition = "PROPOSITION 062- DEATH PENALTY. INITIATIVE STATUTE."
"""
Explanation: Analysis of CA ballot measure financing
Including Proposition 62 to abolish the death penalty in California.
End of explanation
"""
... |
gangiman/CiGraphVis | fragments/plot_processed_papers.ipynb | mit | papers_data = pickle.load(open('papers_data.pkl', 'rb'))
# lets collec all papers and their references into one array, type = 1 means paper is in the user's base, 0 - only in references
all_papers = []
for k in papers_data:
all_papers.append(papers_data[k]['metadata'])
all_papers[-1]['type'] = 1
for ref in... |
KiraHG/pyscbwrapper | pyscbwrapper_en.ipynb | gpl-3.0 | !pip install -q pyscbwrapper
from pyscbwrapper import SCB
"""
Explanation: <a href="https://colab.research.google.com/github/kirajcg/pyscbwrapper/blob/master/pyscbwrapper_en.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Introduction
We want to con... |
phockett/ePSproc | notebooks/ePSproc_demo_CrossSections_Oct2019.ipynb | gpl-3.0 | import sys
import os
import numpy as np
# For module testing, include path to module here
modPath = r'/home/femtolab/github/ePSproc/'
sys.path.append(modPath)
import epsproc as ep
# Confirm available dataTypes... (varies with ePSproc version)
ep.util.dataTypesList()
# Load data from modPath\data
dataPath = os.path.j... |
keras-team/keras-io | examples/graph/ipynb/node2vec_movielens.ipynb | apache-2.0 | import os
from collections import defaultdict
import math
import networkx as nx
import random
from tqdm import tqdm
from zipfile import ZipFile
from urllib.request import urlretrieve
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import ma... |
gdsfactory/gdsfactory | docs/notebooks/plugins/lumerical/1_fdtd_sparameters.ipynb | mit | import gdsfactory as gf
import gdsfactory.simulation.lumerical as sim
gf.tech.SIMULATION_SETTINGS_LUMERICAL_FDTD
sim.write_sparameters_lumerical?
# NBVAL_SKIP
import gdsfactory as gf
import gdsfactory.simulation.lumerical as sim
import lumapi
s = lumapi.FDTD()
gf.components.cells.keys()
components = [
"bend_e... |
wzxiong/DAVIS-Machine-Learning | lectures/classify/Classify2.ipynb | mit | lr = LogisticRegression(fit_intercept=False,C=1e7)
lr.fit(PhiX,Pos)
lr.coef_
PosHatPhi = lr.predict(PhiX)
with plt.style.context(('seaborn-white')):
plot_confusion_matrix(skmetrics.confusion_matrix(Pos,PosHatPhi),[0,1],
title="Confusion matrix for linear fit")
def Phi(x,deg=2):
x = np.c... |
opengeostat/pygslib | pygslib/Ipython_templates/.ipynb_checkpoints/bigaus_raw-checkpoint.ipynb | mit | #general imports
import matplotlib.pyplot as plt
import pygslib
import numpy as np
import pandas as pd
#make the plots inline
%matplotlib inline
#get the data in gslib format into a pandas Dataframe
mydata= pygslib.gslib.read_gslib_file('../data/cluster.dat')
# This is a 2D file, in this GS... |
travc/paper-Predicted-MF-Quarantine-Length-Data-and-Code | code/Cleaning temperatures.ipynb | mit | # boilerplate includes
import sys
import os
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
#from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
import seaborn as sns
import datetime
import scipy.interpolate
# import re
from IPython.display import display, HTML
%matplotlib notebo... |
tensorflow/lucid | notebooks/misc/rl_util.ipynb | apache-2.0 | # use tensorflow 1.x
%tensorflow_version 1.x
# install specific version of lucid
!pip install git+git://github.com/tensorflow/lucid.git@16a03dee8f99af4cdd89d6b7c1cc913817174c83
def longest_common_prefix(l):
l = set([s[: min(map(len, l))] for s in l])
while len(l) > 1:
l = set([s[:-1] for s in l])
... |
vicolab/ml-pyxis | examples/basic-read-and-write.ipynb | mit | from __future__ import print_function
import time
import numpy as np
import pyxis as px
np.random.seed(1234)
"""
Explanation: Basic read and write operations
In this example we will explore how to create and read a simple Lightning Memory-Mapped Database (LMDB) using pyxis.
Writing data
End of explanation
"""
nb... |
tpin3694/tpin3694.github.io | python/cleaning_text.ipynb | mit | # Create a list of three strings.
incoming_reports = ["We are attacking on their left flank but are losing many men.",
"We cannot see the enemy army. Nothing else to report.",
"We are ready to attack but are waiting for your orders."]
"""
Explanation: Title: Cleaning Text
Slug: cleaning... |
fazzolini/fast_ai | deeplearning1/nbs/dogscats-ensemble.ipynb | apache-2.0 | path = "data/dogscats/"
# path = "data/dogscats/sample/"
model_path = path + 'models/'
if not os.path.exists(model_path): os.mkdir(model_path)
batch_size=128
# batch_size=1
batches = get_batches(path+'train', shuffle=False, batch_size=batch_size)
val_batches = get_batches(path+'valid', shuffle=False, batch_size=batch... |
ml4a/ml4a-guides | examples/models/stylegan2.ipynb | gpl-2.0 | %tensorflow_version 1.x
!pip3 install --quiet ml4a
"""
Explanation: StyleGAN2: hi-res generative modeling
StyleGAN2 is a generative model architecture which generates state-of-the-art, high-resolution images. This module is based on the original code and paper by NVIDIA, and comes with several pre-trained models, as ... |
DaveBackus/Data_Bootcamp | Code/Lab/FilesPython.ipynb | mit | f = open('filespython.txt', 'r')
for line in f:
print(line)
f.close()
"""
Explanation: Reading (and Writing) Files (without Pandas)
This notebook is going to help introduce how to work with text files in Python without relying on the underlying magic of Pandas. In addition to being interesting and useful in ... |
HazyResearch/snorkel | tutorials/workshop/Workshop_2_Writing_Labeling_Functions.ipynb | apache-2.0 | %load_ext autoreload
%autoreload 2
%matplotlib inline
import re
import sys
import numpy as np
# Connect to the database backend and initalize a Snorkel session
from lib.init import *
from lib.scoring import *
from lib.lf_factories import *
from snorkel.lf_helpers import test_LF
from snorkel.annotations import load_g... |
turbomanage/training-data-analyst | quests/serverlessml/04_keras/solution/keras_dnn.ipynb | apache-2.0 | %%bash
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
import os, json, math
import numpy as np
import shutil
import tensorflow as tf
print("TensorFlow version: ",tf.version.VERSION)
PROJECT = "your-gcp-project-here" # REPLACE WITH YOUR PRO... |
tensorflow/examples | tensorflow_examples/lite/model_maker/third_party/efficientdet/det_advprop_tutorial.ipynb | apache-2.0 | %%capture
#@title
import os
import sys
import tensorflow.compat.v1 as tf
# Download source code.
if "efficientdet" not in os.getcwd():
!git clone --depth 1 https://github.com/google/automl
os.chdir('automl/efficientdet')
sys.path.append('.')
!pip install -r requirements.txt
!pip install -U 'git+https://githu... |
arnicas/eyeo_nlp | python/.ipynb_checkpoints/cluster_analysis_by_brandon_rose-checkpoint.ipynb | cc0-1.0 | import numpy as np
import pandas as pd
import nltk
import re
import os
import codecs
from sklearn import feature_extraction
"""
Explanation: Brandon's home
Document Clustering with Python
A Notebook by Brandon Rose (http://brandonrose.org/clustering)
Modified by Lynn Cherny to use new data (SOTU speeches), 6/3/16
In t... |
tensorflow/workshops | blog/TFX_Pipeline_for_ALBERT_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... |
benlaken/Romania_2016 | test_stations.ipynb | mit | # Load some libraries
import os
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
from tqdm import *
from colorama import Fore
matplotlib.style.use('ggplot')
%matplotlib inline
"""
Explanation: Example of working with GHCN data from Romania
Global historcal climate network weathe... |
karlstroetmann/Artificial-Intelligence | Python/6 Classification/NLTK-Introduction.ipynb | gpl-2.0 | import nltk
"""
Explanation: The Natural Language Toolkit (NLKT)
This notebook introduces the <a href="https://www.nltk.org">Natural Language ToolKit</a> (NLKT). Our first example is concerned with <em style="color:blue;">classification</em>: We want to see whether it is possible to predict the gender of a given firs... |
SBRG/ssbio | docs/notebooks/GEM-PRO - SBML Model.ipynb | mit | import sys
import logging
# Import the GEM-PRO class
from ssbio.pipeline.gempro import GEMPRO
# Printing multiple outputs per cell
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
"""
Explanation: GEM-PRO - SBML Model
This notebook gives an example of how to ... |
spulido99/Programacion | Margarita/Taller 1_Margarita Valderrama (1).ipynb | mit | import sys
print('{0[0]}.{0[1]}'.format(sys.version_info))
"""
Explanation: Taller 1: Básico de Python
Funciones
Listas
Diccionarios
Este taller es para resolver problemas básicos de python. Manejo de listas, diccionarios, etc.
El taller debe ser realizado en un Notebook de Jupyter en la carpeta de cada uno. Debe ha... |
willvousden/emcee | docs/_static/notebooks/quickstart.ipynb | mit | import emcee
emcee.__version__
"""
Explanation: Quickstart
This notebook was made with the following version of emcee:
End of explanation
"""
import numpy as np
"""
Explanation: The easiest way to get started with using emcee is to use it for a project. To get you started, here’s an annotated, fully-functional exam... |
geoscixyz/computation | docs/case-studies/PF/TKC_PF.ipynb | mit | # Start by importing SimPEG, the potential fields package and
import os
import numpy as np
import matplotlib.pyplot as plt
from SimPEG import Mesh
from SimPEG import Utils
from SimPEG import Maps
from SimPEG import Regularization
from SimPEG import DataMisfit
from SimPEG import Optimization
from SimPEG import InvProb... |
pierrelb/RMG-Py | ipython/canteraSensitivityComparison.ipynb | mit | import cantera
print cantera.__version__
from rmgpy.chemkin import *
from rmgpy.tools.canteraModel import *
from rmgpy.tools.plot import parseCSVData
from rmgpy.species import Species
from IPython.display import display, Image
"""
Explanation: A Cantera Simulation with Reaction Sensitivity: Comparison with Native RMG... |
stinebuu/nest-simulator | doc/userdoc/model_details/IAF_neurons_singularity.ipynb | gpl-2.0 | import sympy as sp
sp.init_printing(use_latex=True)
from sympy.matrices import zeros
tau_m, tau_s, C, h = sp.symbols('tau_m, tau_s, C, h')
"""
Explanation: IAF neurons singularity
This notebook describes how NEST handles the singularities appearing in the ODE's of integrate-and-fire model neurons with alpha- or expone... |
ES-DOC/esdoc-jupyterhub | notebooks/cccr-iitm/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', 'cccr-iitm', 'sandbox-2', 'atmos')
"""
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: CCCR-IITM
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: Dynamical Core, Radiati... |
GoogleCloudPlatform/training-data-analyst | self-paced-labs/vertex-ai/vertex-bqml/lab_exercise.ipynb | apache-2.0 | # Retrieve and set PROJECT_ID and REGION environment variables.
PROJECT_ID = !(gcloud config get-value core/project)
PROJECT_ID = PROJECT_ID[0]
BQ_LOCATION = 'US'
REGION = 'us-central1'
"""
Explanation: Deploy a BigQuery ML user churn propensity model to Vertex AI for online predictions
Learning objectives
Explore a... |
kimkipyo/dss_git_kkp | 통계, 머신러닝 복습/160613월_14일차_정규화(Regularization), 로지스틱 회귀 분석(Logistic Regression)/1.주간 시험_전처리,회귀분석.ipynb | mit | from sklearn.preprocessing import StandardScaler
X = np.array([[3,6], [6,7]])
#스케일러 객체 생성
scaler = StandardScaler()
#분포 추정
scaler.fit(X)
#스케일링
X2 = scaler.transform(X)
X
X2
"""
Explanation: 문제3
StandardScaler 클래스를 사용하여 X라는 2차원 배열 변수에 있는 데이터의 평균을 0, 분산을 1로 만들기 위한 Scikit-Learn 코드를 완성하세요
End of explanation
"""
X = np... |
xiaoxiaoyao/MyApp | jupyter_notebook/Titanic.ipynb | unlicense | import pandas as pd #数据分析
import numpy as np #科学计算
from pandas import Series,DataFrame
data_train = pd.read_csv("./Titanic/train.csv")
data_train.tail() #pandas是常用的python数据处理包,把csv文件读入成dataframe各式,我们在ipython notebook中,看到data_train如下所示:
"""
Explanation: Titanic: Machine Learning from Disaster
Start here! Predict survi... |
probml/pyprobml | internal/py_to_notebook_book1.ipynb | mit | from time import time
init = time()
import re
import os
import sys
import json
import yaml
from functools import reduce
from collections import ChainMap
import subprocess
import pandas as pd
from glob import glob
import nbformat
import jax
"""
Explanation: Main Workflow
End of explanation
"""
old_nb_files = glob... |
brunnerp/PythonFachkurs | 01_introduction/intro_to_python.ipynb | mit | print("Hello, world!")
"""
Explanation: Introduction to Python
Why Python?
easy to learn and use
excellent for beginners, yet superb for experts
highly scalable, suitable for large projects as well as small ones
rapid development
portable, cross-platform
powerful standard libs
wealth of 3rd party packages
And don't ... |
CalPolyPat/phys202-2015-work | days/day08/Display.ipynb | mit | class Ball(object):
pass
b = Ball()
b.__repr__()
print(b)
"""
Explanation: Display of Rich Output
In Python, objects can declare their textual representation using the __repr__ method.
End of explanation
"""
class Ball(object):
def __repr__(self):
return 'TEST'
b = Ball()
print(b)
"""
Explanatio... |
mne-tools/mne-tools.github.io | 0.13/_downloads/plot_background_filtering.ipynb | bsd-3-clause | import numpy as np
from scipy import signal, fftpack
import matplotlib.pyplot as plt
from mne.time_frequency.tfr import morlet
import mne
sfreq = 1000.
f_p = 40.
ylim = [-60, 10] # for dB plots
xlim = [2, sfreq / 2.]
blue = '#1f77b4'
"""
Explanation: Background information on filtering
Here we give some background... |
weikang9009/giddy | notebooks/RankMarkov.ipynb | bsd-3-clause | import libpysal as ps
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import pandas as pd
import geopandas as gpd
"""
Explanation: Full Rank Markov and Geographic Rank Markov
Author: Wei Kang weikang9009@gma... |
google/starthinker | colabs/fred_regional_to_bigquery.ipynb | apache-2.0 | !pip install git+https://github.com/google/starthinker
"""
Explanation: Federal Reserve Regional Data
Download federal reserve region.
License
Copyright 2020 Google LLC,
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a co... |
kylemede/DS-ML-sandbox | notebooks/regression.ipynb | gpl-3.0 | %matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(10)
dossageEffectiveness = abs(np.random.normal(5.0, 1.5, 1000))
repurchaseRate = (dossageEffectiveness + np.random.normal(0, 0.1, 1000)) * 3
repurchaseRate/=np.max(repurchaseRate)
plt.scatter(dossageEffectiveness, repurchaseRate)
plt... |
cycomachead/info290 | lab4_decision_trees/.ipynb_checkpoints/Lab4_decision_trees-checkpoint.ipynb | bsd-2-clause | from __future__ import division, print_function
from collections import Counter, defaultdict
from itertools import combinations
import pandas as pd
import numpy as np
import itertools
import sklearn
from sklearn.tree import DecisionTreeClassifier
from sklearn.feature_extraction import DictVectorizer #to turn categori... |
yangw1234/BigDL | python/chronos/use-case/network_traffic/network_traffic_model_forecasting.ipynb | apache-2.0 | def plot_predict_actual_values(date, y_pred, y_test, ylabel):
"""
plot the predicted values and actual values (for the test data)
"""
fig, axs = plt.subplots(figsize=(16,6))
axs.plot(date, y_pred, color='red', label='predicted values')
axs.plot(date, y_test, color='blue', label='actual values')... |
swirlingsand/deep-learning-foundations | neural-network-numpy-only/dlnd-your-first-neural-network.ipynb | mit | %matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
"""
Explanation: Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code... |
NlGG/MCMC | RWMH.ipynb | mit | X = np.zeros(10)
for i in range(len(X)):
X[i] = np.random.normal(5,1)
X
"""
Explanation: 観測されたデータ。N(5,1)から作られた10個の乱数。
End of explanation
"""
class RWMH:
def __init__(self, X):
self.mu = 2
self.freedom = 5.0
self.x_var = np.mean(X)
def prior_dist(self, t):
ft = ma... |
lmcinnes/hdbscan | notebooks/Python vs Java.ipynb | bsd-3-clause | import pandas as pd
import numpy as np
reference_timing_series = pd.read_csv('reference_impl_external_timings.csv',
index_col=(0,1), names=('dim', 'size', 'time'))['time']
hdbscan_v01_timing_series = pd.read_csv('hdbscan01_timings.csv',
in... |
enoordeh/StatisticalMethods | .archive/2015/scikit-learn/Linear_Regression.ipynb | gpl-2.0 | import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
from sklearn import datasets, linear_model
# Code source: Jaques Grobler
# License: BSD 3 clause
# Load the boston dataset, and focus on just one attribute: LSTAT (attribute 13)
boston = datasets.load_boston()
X = np.atleast_2d(boston.data[:,12]).... |
fluxcapacitor/source.ml | jupyterhub.ml/notebooks/train_deploy/zz_under_construction/tensorflow/optimize/02_Feed_Queue_HDFS.ipynb | apache-2.0 | %%bash
hadoop fs -copyFromLocal /root/datasets/linear /
%%bash
hadoop fs -ls /linear
"""
Explanation: Feed Data with Queue from HDFS
Populate HDFS with Sample Dataset
End of explanation
"""
import tensorflow as tf
tf.reset_default_graph()
sess = tf.Session()
print(sess)
"""
Explanation: Create TensorFlow Sessi... |
tensorflow/docs-l10n | site/ko/agents/tutorials/4_drivers_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... |
phoebe-project/phoebe2-docs | 2.1/tutorials/building_a_system.ipynb | gpl-3.0 | !pip install -I "phoebe>=2.1,<2.2"
"""
Explanation: Building a System
Setup
Let's first make sure we have the latest version of PHOEBE 2.1 installed. (You can comment out this line if you don't use pip for your installation or don't want to update to the latest release).
End of explanation
"""
import phoebe
from pho... |
km-Poonacha/python4phd | Session 1/ipython/Lesson 1 - Data and Types.ipynb | gpl-3.0 | integer = 99
string = 'poonacha'
print('This is an integer: ',integer )
print('This is a string: ',string )
"""
Explanation: Lesson 1: Data and Types
In this lesson we learn about the basic data types and data structures and play with them a little.
Defines the format by which you input data to a program, modify it... |
GoogleCloudPlatform/training-data-analyst | courses/machine_learning/deepdive2/production_ml/labs/mlmd_tutorial.ipynb | apache-2.0 | !pip install --upgrade pip
"""
Explanation: Better ML Engineering with ML Metadata
Learning Objectives
Download the dataset
Create an InteractiveContext
Construct the TFX Pipeline
Query the MLMD Database
Introduction
Assume a scenario where you set up a production ML pipeline to classify penguins. The pipeline inges... |
GoogleCloudPlatform/vertex-ai-samples | notebooks/community/managed_notebooks/gaming_churn_prediction/churn-prediction-for-game-developers.ipynb | apache-2.0 | import os
PROJECT_ID = ""
# Get your Google Cloud project ID from gcloud
if not os.getenv("IS_TESTING"):
shell_output=!gcloud config list --format 'value(core.project)' 2>/dev/null
PROJECT_ID = shell_output[0]
print("Project ID: ", PROJECT_ID)
"""
Explanation: Churn prediction for game developers using G... |
gfeiden/Notebook | Projects/ngc2516_spots/ngc2516_vs_pleiades.ipynb | mit | %matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
"""
Explanation: NGC 2516 vs the Pleiades
These two clusters have similar ages, but do their CMDs show a similar morphology for low-mass stars?
End of explanation
"""
ngc2516 = np.genfromtxt('data/ngc2516_Christophe_v3.dat') # da... |
LSSTC-DSFP/LSSTC-DSFP-Sessions | Sessions/Session02/Day4/AdvancedNeuralNetworkSolution.ipynb | mit | # Imports / plotting configuration
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_context('poster')
plt.rcParams['image.cmap'] = 'viridis'
np.random.seed(13)
import json
import os
# Change this to `'tensorflow'` if you prefer
backend = 'theano'
config = {'image_dim... |
cpcloud/ibis | docs/tutorial/04-More-Value-Expressions.ipynb | apache-2.0 | !curl -LsS -o $TEMPDIR/geography.db 'https://storage.googleapis.com/ibis-tutorial-data/geography.db'
import os
import tempfile
import ibis
ibis.options.interactive = True
connection = ibis.sqlite.connect(
os.path.join(tempfile.gettempdir(), 'geography.db')
)
"""
Explanation: More Value Expressions
Let's walk t... |
dipanjank/ml | data_analysis/ccpp.ipynb | gpl-3.0 | import numpy as np
import pandas as pd
%pylab inline
pylab.style.use('ggplot')
import seaborn as sns
pp_data = pd.read_csv('ccpp.csv')
pp_data.head()
"""
Explanation: Combined Cycle Power Plant Regression
This is an analysis of the <a href="https://archive.ics.uci.edu/ml/datasets/Combined+Cycle+Power+Plant">Combined... |
shanaka-desoysa/tensorflow | hw8/e63_Assign08_NN_TensorFlow-Shanaka_DeSoysa.ipynb | apache-2.0 | import tensorflow as tf
hello = tf.constant('It works!')
sess = tf.Session()
print(sess.run(hello))
"""
Explanation: E-63 Big Data Analytics - Assignment 08 - TensorFlow
Shanaka De Soysa
Problem 1
Install newest release of TensorFlow 1.0.1 on the operating system of your choice. Use installation instructions on https... |
bgroveben/python3_machine_learning_projects | ApacheMXNet/linear_regression_from_scratch.ipynb | mit | # The kernel for this notebook is running Python 3, but we'll see:
from __future__ import print_function
import mxnet as mx
from mxnet import nd, autograd, gluon
mx.random.seed(1)
"""
Explanation: Linear regression from scratch
Powerful ML libraries can eliminate repetitive work, but if you rely too much on abstractio... |
fukuball/FukuML-Tutorial | Perceptron Binary Classification Learning Algorithm Tutorial.ipynb | mit | import FukuML.PLA as pla
"""
Explanation: Perceptron Binary Classification Learning Algorithm Tutorial
註:這個 Tutorial 主要還是介紹怎麼使用 FukuML,如果非必要並不會涉入太多演算法或數學式的細節,若大家對機器學習有興趣,還是建議觀看完整的課程。
Perceptron Binary Classification Learning Algorithm(PLA)是最基礎的機器學習算法,主要用在讓機器學習分類,基礎我們會使用在二元分類,再慢慢推廣至多元分類。其核心想法也不難,追根究底就是個知錯能改的演算法,只要有錯就修正... |
gtrichards/QuasarSelection | SpIESHighzCandidateSelection.ipynb | mit | # Read in data file
%matplotlib inline
from astropy.table import Table
import numpy as np
import matplotlib.pyplot as plt
data = Table.read('GTR-ADM-QSO-ir-testhighz_findbw_lup_2016_starclean.fits')
# X is in the format need for all of the sklearn tools, it just has the colors
X = np.vstack([ data['ug'], data['gr'], d... |
gVallverdu/cookbook | IntegrationNumerique.ipynb | gpl-2.0 | %pylab --no-import-all inline
"""
Explanation: Intégration numérique en Python
Germain Salvato-Vallverdu germain.vallverdu@univ-pau.fr
L'objectif de ce TP est de mettre en pratique le langage python pour intégrer numériquement une fonction.
Après avoir étudier la fonction des méthodes basiques comme la méthode des tra... |
Bowenislandsong/Distributivecom | Archive/Ray Project Tutorial Walkthrough.ipynb | gpl-3.0 | import ray
ray.init("172.56.22.22:11592")
"""
Explanation: Tutorial
Overview
Ray is a Python-based distributed execution $\bf \text{engine}$. The same code can be run on a single machine to achieve efficient multiprocessing, and it can be used on a cluster for large computations.
When using Ray, several processes are ... |
diegocavalca/Studies | deep-learnining-specialization/1. neural nets and deep learning/resources/Python Basics With Numpy v3.ipynb | cc0-1.0 | ### START CODE HERE ### (≈ 1 line of code)
test = 'Hello World'
### END CODE HERE ###
print ("test: " + test)
"""
Explanation: Python Basics with Numpy (optional assignment)
Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help fami... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.