repo_name
stringlengths
6
77
path
stringlengths
8
215
license
stringclasses
15 values
content
stringlengths
335
154k
abulbasar/machine-learning
SparkML - 06 Movie Recommendation.ipynb
apache-2.0
import sys, glob, os SPARK_HOME = "/Users/abulbasar/Downloads/spark-2.3.1-bin-hadoop2.7" sys.path.append(SPARK_HOME + "/python") sys.path.append(glob.glob(SPARK_HOME + "/python/lib/py4j*.zip")[0]) from pyspark.sql import SparkSession, functions as F spark = (SparkSession .builder .config("spark.master...
johnhw/summerschool2015
CrashCourse_Lecture1.ipynb
mit
# standard imports import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.mplot3d.axes3d as axes3d import seaborn import sklearn.preprocessing, sklearn.cluster, sklearn.tree, sklearn.neighbors, sklearn.ensemble, sklearn.multiclass, sklearn.feature_selection import ipy_table import sklearn.svm, sklearn.c...
skamkar/harvard-yard
boston_housing.ipynb
mit
# Import libraries necessary for this project import numpy as np import pandas as pd from sklearn.cross_validation import ShuffleSplit # Import supplementary visualizations code visuals.py import visuals as vs # Pretty display for notebooks %matplotlib inline # Load the Boston housing dataset data = pd.read_csv('hou...
GoogleCloudPlatform/mlops-on-gcp
workshops/guided-projects/guided_project_2.ipynb
apache-2.0
import os """ Explanation: Guided Project 2 Learning Objective: Learn how to adapt the tfx template to an existing model. In this guided project, we will use the tfx template tool to create a TFX pipeline around the covertype dataset. The goal is to adapt the template pipeline to make use of the model code for the c...
dlsun/symbulate
tutorial/gs_joint.ipynb
mit
from symbulate import * %matplotlib inline """ Explanation: Getting Started with Symbulate Section 3. Multiple Random Variables and Joint Distributions <Random variables | Contents | Conditioning> Every time you start Symbulate, you must first run (SHIFT-ENTER) the following commands. End of explanation """ def numb...
Hasil-Sharma/Neural-Networks-CS231n
assignment1/knn.ipynb
gpl-3.0
# Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inline plt.rcParams['figure.figsize'] = (10....
betatim/BlackBox
examples/ask-and-tell.ipynb
bsd-3-clause
import numpy as np np.random.seed(1234) %matplotlib inline import matplotlib.pyplot as plt plt.set_cmap("viridis") """ Explanation: Async optimization Loop Tim Head, February 2017. End of explanation """ from skopt.learning import ExtraTreesRegressor from skopt import Optimizer noise_level = 0.1 # Our 1D toy prob...
mattmcd/PyBayes
scripts/spectral_methods_20210306.ipynb
apache-2.0
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns %matplotlib inline """ Explanation: Spectral Methods in TensorFlow Converting some of the examples from Spectral Methods in MATLAB by Nick Trefethen into TensorFlow. End of explanation """ def calc_diff_err_p1(n): h...
Flaviolib/dx
00_dx_quickstart.ipynb
agpl-3.0
import dx import datetime as dt import pandas as pd import seaborn as sns; sns.set() """ Explanation: <img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="45%" align="right" border="4"> Quickstart This brief first part illustrates---without much explanation---the usage of the DX Analytics library...
dsavransky/MAE4060
Notebooks/Hemispherical Shell.ipynb
mit
from miscpy.utils.sympyhelpers import * init_printing() m,r,R,R1,R2,th,ph = symbols('m,r,R,R_1,R_2,theta,phi') """ Explanation: Geometric and Inertial Properties of a Hemispherical Shell End of explanation """ rdmO = r*Matrix([cos(th)*sin(ph),sin(th)*sin(ph), cos(ph)]);rdmO """ Explanation: The shell has interior r...
google-research/google-research
linear_vae/DontBlameTheELBO.ipynb
apache-2.0
%tensorflow_version 1.x import tensorflow as tf from tensorflow.data import Dataset import tensorflow_datasets as tfds import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt _LOG_2PI = np.log(2 * np.pi) """ Explanation: Copyright 2019 Google LLC. Licensed under the Apache License, Version 2.0 (t...
bayesimpact/bob-emploi
data_analysis/notebooks/datasets/rome/update_from_v342_to_v343.ipynb
gpl-3.0
import collections import glob import os from os import path import matplotlib_venn import pandas as pd rome_path = path.join(os.getenv('DATA_FOLDER'), 'rome/csv') OLD_VERSION = '342' NEW_VERSION = '343' old_version_files = frozenset(glob.glob(rome_path + '/*{}*'.format(OLD_VERSION))) new_version_files = frozenset(...
thisray/MS_Course
other/ray_workshop_0723.ipynb
mit
df = make_toy_df('ABC', range(5)) print('type of {}: {}'.format('df', type(df))) df print('type of {}: {}'.format("df['A']", type(df['A']))) df['A'] ## dictionary-style & attribute-style to access a column print(df['A']) print(df.A) print(df['A'] is df.A) ## add a new column df['shape'] = list(range(df.shape[0])) d...
opalytics/opalytics-ticdat
examples/expert_section/notebooks/toehold_problem.ipynb
bsd-2-clause
def exception_thrown(f): try: f() except Exception as e: return str(e) """ Explanation: The toehold problem The "toehold problem" is named after a tech support response. The nature of the problem is that in order to take advantage of the algebraic constraint modeling provided by docplex, then t...
intel-analytics/analytics-zoo
apps/variational-autoencoder/using_variational_autoencoder_to_generate_digital_numbers.ipynb
apache-2.0
# a bit of setup import numpy as np from bigdl.nn.criterion import * from bigdl.dataset import mnist from zoo.pipeline.api.keras.layers import * from zoo.pipeline.api.keras.models import Model from zoo.pipeline.api.keras.utils import * import datetime as dt IMAGE_SIZE = 784 IMAGE_ROWS = 28 IMAGE_COLS = 28 IMAGE_CHANNE...
phoebe-project/phoebe2-docs
2.1/examples/diher_misaligned.ipynb
gpl-3.0
!pip install -I "phoebe>=2.1,<2.2" """ Explanation: DI Her: Misaligned Binary In this example, we'll reproduce Figure 8 in the misalignment release paper (Horvat et al. 2018). <img src="horvat+18_fig8.png" alt="Figure 8" width="400px"/> Setup Let's first make sure we have the latest version of PHOEBE 2.1 installed. (Y...
gururajl/deep-learning
intro-to-tflearn/TFLearn_Sentiment_Analysis.ipynb
mit
import pandas as pd import numpy as np import tensorflow as tf import tflearn from tflearn.data_utils import to_categorical """ Explanation: Sentiment analysis with TFLearn In this notebook, we'll continue Andrew Trask's work by building a network for sentiment analysis on the movie review data. Instead of a network w...
donK23/pyData-Projects
KC_RecSys/project/notebook/Recommenders_5Star.ipynb
apache-2.0
# Import data path = "../data/petdata_1000_100.csv" raw_data = pd.read_csv(path, index_col="doc_uri") assert raw_data.shape == (1000,100), "Import error, df has false shape" """ Explanation: Preprocess data End of explanation """ # Convert df data = raw_data.unstack().to_frame().reset_index() data.columns = ["user",...
newworldnewlife/TensorFlow-Tutorials
04_Save_Restore.ipynb
mit
from IPython.display import Image Image('images/02_network_flowchart.png') """ Explanation: TensorFlow Tutorial #04 Save & Restore by Magnus Erik Hvass Pedersen / GitHub / Videos on YouTube Introduction This tutorial demonstrates how to save and restore the variables of a Neural Network. During optimization we save th...
satishkt/lending_club_classification
LoanDefaultPrediction.ipynb
apache-2.0
df3a.dropna(axis=1, how='all',inplace=True) df3a.columns.tolist() """ Explanation: Since there are 111 columns , lets first find columns with null/empty through out so that we can quickly clean them up. We go for 111 columns to 57 columns which have some data. End of explanation """ df3a.application_type.unique() #...
diegocavalca/Studies
phd-thesis/benchmarkings/am207-NILM-project-master/CO.ipynb
cc0-1.0
from __future__ import print_function, division import numpy as np import pandas as pd from os.path import join import pickle import copy from pylab import rcParams import matplotlib.pyplot as plt %matplotlib inline rcParams['figure.figsize'] = (13, 6) import nilmtk from nilmtk import DataSet, TimeFrame, MeterGroup, ...
Shirling-VT/davitpy_sam
docs/notebook/radarStruct.ipynb
gpl-3.0
# Import radar module %pylab inline from davitpy.pydarn.radar import * """ Explanation: network(), radar() and site() objects This notebook introduces the high-level python interface with the radar.dat and hdw.dat content. For more in-depth access (i.e., your own hdw.dat), look at the radInfoIO module: radInfoIo? ...
tpin3694/tpin3694.github.io
machine-learning/loading_scikit-learns_boston_housing_dataset.ipynb
mit
# Load libraries from sklearn import datasets import matplotlib.pyplot as plt """ Explanation: Title: Loading scikit-learn's Boston Housing Dataset Slug: loading_scikit-learns_boston_housing-dataset Summary: Loading the built-in Boston housing datasets of scikit-learn. Date: 2016-08-31 12:00 Category: Machine Learni...
AdityaSoni19031997/Machine-Learning
AV/AV_Enigma_ML_initial_eda.ipynb
mit
%load_ext autoreload %autoreload 2 %matplotlib inline from fastai.imports import * from fastai.structured import * from pandas_summary import DataFrameSummary PATH = os.getcwd() train_df = pd.read_csv(f'{PATH}\\train.csv', low_memory=False) test_df = pd.read_csv(f'{PATH}\\test.csv', low_memory=False) def display_a...
jaidevd/inmantec_fdp
notebooks/day3/03_feature_extraction.ipynb
mit
X, y = make_classification(n_informative=2, random_state=11) print(X.shape) """ Explanation: Example: Arbitrary classification End of explanation """ xtrain, xtest, ytrain, ytest = train_test_split(X, y, random_state=2) lr = LogisticRegression() lr.fit(xtrain, ytrain) prediction = lr.predict(xtest) print("F1 score: ...
weikang9009/pysal
notebooks/explore/esda/Spatial Autocorrelation for Areal Unit Data.ipynb
bsd-3-clause
import sys import os sys.path.append(os.path.abspath('..')) from pysal.explore import esda import pandas as pd import geopandas as gpd import pysal.lib as lps import numpy as np import matplotlib.pyplot as plt %matplotlib inline """ Explanation: Exploratory Analysis of Spatial Data: Spatial Autocorrelation In this n...
mohsinhaider/pythonbootcampacm
Objects and Data Structures/Tuples.ipynb
mit
# Initializing a Tuple day_tuple = ("MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY") """ Explanation: Tuples A tuple is an immutable, indexable, and heterogenous sequence of objects. Unlike a list, the immutability of tuple bars it from being able to change its objects (in place). The semantics of the tuple all...
mkuron/espresso
doc/tutorials/11-ferrofluid/11-ferrofluid_part3.ipynb
gpl-3.0
import espressomd espressomd.assert_features('DIPOLES', 'LENNARD_JONES') from espressomd.magnetostatics import DipolarP3M import numpy as np """ Explanation: Ferrofluid - Part III Table of Contents Susceptibility with fluctuation formulas Derivation of the fluctuation formula Simulation Magnetization curve of a 3D...
miaecle/deepchem
examples/tutorials/01_The_Basic_Tools_of_the_Deep_Life_Sciences.ipynb
mit
%tensorflow_version 1.x !curl -Lo deepchem_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py import deepchem_installer %time deepchem_installer.install(version='2.3.0') """ Explanation: Tutorial 1: The Basic Tools of the Deep Life Sciences Welcome to DeepChem's introducto...
google/flax
examples/mnist/mnist.ipynb
apache-2.0
# Install ml-collections & latest Flax version from Github. !pip install -q ml-collections git+https://github.com/google/flax example_directory = 'examples/mnist' editor_relpaths = ('configs/default.py', 'train.py') repo, branch = 'https://github.com/google/flax', 'main' # (If you run this code in Jupyter[lab], then...
jameszw/udacity-deep-learning
project3-tv-script-generation/dlnd_tv_script_generation.ipynb
mit
""" DON'T MODIFY ANYTHING IN THIS CELL """ import helper data_dir = './data/simpsons/moes_tavern_lines.txt' text = helper.load_data(data_dir) # Ignore notice, since we don't use it for analysing the data text = text[81:] """ Explanation: TV Script Generation In this project, you'll generate your own Simpsons TV scrip...
banyh/ShareIPythonNotebook
NLP_With_Python/Ch10.ipynb
gpl-3.0
import nltk grammar = nltk.grammar.FeatureGrammar.fromstring(""" % start S S[SEM=(?np + WHERE + ?vp)] -> NP[SEM=?np] VP[SEM=?vp] VP[SEM=(?v + ?pp)] -> IV[SEM=?v] PP[SEM=?pp] VP[SEM=(?v + ?ap)] -> IV[SEM=?v] AP[SEM=?ap] NP[SEM=(?det + ?n)] -> Det[SEM=?det] N[SEM=?n] PP[SEM=(?p + ?np)] -> P[SEM=?...
stanleykylee/worldbank-world-development-indicators-distributed-tf
src/explore_indicators.ipynb
gpl-3.0
import csv count_dict = {} with open('WDI_Data.csv', 'rb') as csv_file: csv_reader = csv.reader(csv_file, delimiter=',') idx = 0 for row in csv_reader: # skip first row if (idx == 0): idx += 1 continue # indicator name for this row ind_name = row[3] ...
supergis/git_notebook
geospatial/gdal/gdal-geometry.ipynb
gpl-3.0
from osgeo import gdal, gdalconst from osgeo.gdalconst import * import gdal, gdalconst from osgeo import ogr """ Explanation: OGR-Geometry and Projection 几何对象与地图投影的使用。 by openthings@163.com, 2016-04-25. OGR矢量库:简单的矢量数据读写,是GDAL的一部分。 相关模块: Numeric:高速的数组处理,对栅格数据尤其重要 NumPy:下一代的Numeric 更强大的gis库 http://www.gispython.org/ ...
jdhp-docs/python-notebooks
python_matplotlib_efficient_interactive_matplotlib_plots_in_jupyter_notebooks_en.ipynb
mit
%matplotlib notebook %matplotlib notebook import numpy as np import matplotlib.pyplot as plt import time import ipywidgets from ipywidgets import interact """ Explanation: Efficient interactive Matplotlib plots in Jupyter notebooks End of explanation """ @interact(t=(0, 100, 1)) def plot(t): fig = plt.figure...
Edderic/BRML-non-OOP
solutions/ch-2.ipynb
gpl-3.0
from graphviz import Digraph # Sample graph dag = Digraph() dir(dag) dag.edge('A', 'B') dag.edge('B', 'C') dag.edge('C', 'D') dag.edge('A', 'E') dag.edge('E', 'D') dag import pandas as pd import numpy as np adjacency_matrix = pd.DataFrame( [ [0, 1, 0, 0, 1], [1, 0, 1, 0, 0], [0, 1, 0, 1, ...
miaecle/deepchem
examples/tutorials/13_Modeling_Protein_Ligand_Interactions.ipynb
mit
%tensorflow_version 1.x !curl -Lo deepchem_installer.py https://raw.githubusercontent.com/deepchem/deepchem/master/scripts/colab_install.py import deepchem_installer %time deepchem_installer.install(additional_packages=['mdtraj'], version='2.3.0') import deepchem as dc from deepchem.utils import download_url import o...
AtmaMani/pyChakras
udemy_ml_bootcamp/Python-for-Data-Visualization/Geographical Plotting/Choropleth Maps Exercise - Solutions.ipynb
mit
import plotly.graph_objs as go from plotly.offline import init_notebook_mode,iplot,plot init_notebook_mode(connected=True) """ Explanation: <a href='http://www.pieriandata.com'> <img src='../Pierian_Data_Logo.png' /></a> Choropleth Maps Exercise - Solutions Welcome to the Choropleth Maps Exercise! In this exercise ...
mne-tools/mne-tools.github.io
0.19/_downloads/7e2bcdd12e5e1163023780ef6bd1e852/plot_evoked_arrowmap.ipynb
bsd-3-clause
# Authors: Sheraz Khan <sheraz@khansheraz.com> # # License: BSD (3-clause) import numpy as np import mne from mne.datasets import sample from mne.datasets.brainstorm import bst_raw from mne import read_evokeds from mne.viz import plot_arrowmap print(__doc__) path = sample.data_path() fname = path + '/MEG/sample/samp...
a301-teaching/a301_code
notebooks/satellite_radiance_solution.ipynb
mit
from IPython.display import Image Image('figures/full_triangle.png') """ Explanation: MODIS satellite radiance solution -- discussed on day 10: a) Show formally that: $$\Delta \omega \approx \frac{area}{R^2}$$ by integrating a cone like this: End of explanation """ import numpy as np theta = 5*np.pi/180. r_over_l...
julienchastang/unidata-python-workshop
notebooks/Satellite_Data/PlottingSatelliteData.ipynb
mit
from datetime import datetime # Create variables for URL generation # YOUR CODE GOES HERE # Construct the data_url string # YOUR CODE GOES HERE # Print out your URL and verify it works! # YOUR CODE GOES HERE """ Explanation: <a name="pagetop"></a> <div style="width:1000 px"> <div style="float:right; width:98 px; h...
jan-rybizki/Chempy
tutorials/5-Chempy_function_and_stellar_tracer_sampling.ipynb
mit
%pylab inline # loading the default parameters from Chempy.parameter import ModelParameters a = ModelParameters() """ Explanation: Chempy we will now introduce the Chempy function which will calculate the chemical evolution of a one-zone open box model End of explanation """ # Initialising sfr, infall, elements to...
ohlemacher/behaviorDrivenDev
BehaviorDrivenDevWithLettuceAndFlask.ipynb
gpl-2.0
%%bash cat test/features/user.features """ Explanation: Experiments with Behavior Driven Development This is my introduction to behavior driven development (BDD) in Python. I have implemented a simple RESTful application using the Flask web framework. Lettuce is used enforce the mapping of user stories to tests via ve...
jo-tez/aima-python
agents.ipynb
mit
from agents import * class BlindDog(Agent): def eat(self, thing): print("Dog: Ate food at {}.".format(self.location)) def drink(self, thing): print("Dog: Drank water at {}.".format( self.location)) dog = BlindDog() """ Explanation: AGENT An agent, as defined in 2.1 is anything th...
tensorflow/docs-l10n
site/ko/tutorials/estimator/keras_model_to_estimator.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...
ML4DS/ML4all
C4.Classification_SVM/.ipynb_checkpoints/SVM-checkpoint.ipynb
mit
# To visualize plots in the notebook %matplotlib inline # Imported libraries #import csv #import random #import matplotlib import matplotlib.pyplot as plt from mpl_toolkits import mplot3d #import pylab import numpy as np #from sklearn.preprocessing import PolynomialFeatures from sklearn import svm from sklearn.datase...
JWarmenhoven/DBDA-python
Notebooks/Chapter 12.ipynb
mit
import pandas as pd import numpy as np import pymc3 as pm import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings("ignore", category=FutureWarning) import theano.tensor as tt from matplotlib import gridspec %matplotlib inline plt.style.use('seaborn-white') color = '#87ceeb' %lo...
cgpotts/cs224u
nli_02_models.ipynb
apache-2.0
__author__ = "Christopher Potts" __version__ = "CS224u, Stanford, Spring 2022" """ Explanation: Natural language inference: models End of explanation """ from collections import Counter from itertools import product from nltk.tokenize.treebank import TreebankWordTokenizer import numpy as np import os import pandas a...
SylvainCorlay/bqplot
examples/Marks/Object Model/Graph.ipynb
apache-2.0
fig_layout = Layout(width='960px', height='500px') """ Explanation: Nodes and Links should be supplied to the Graph mark. <p>Node attributes | Attribute| Type | Description | Default | |:----------:|:-------------:|:------:| | label | str | node label | mandatory attribute | | label_display | {center, ou...
pligor/predicting-future-product-prices
04_time_series_prediction/32_price_history_autoencoder.ipynb
agpl-3.0
batch_size = 1 #full_train_size = 55820 #train_size = 55800 #small_train_size = 6000 #just because of performance reasons, no statistics behind this decision #test_size = 6200 data_path = '../../../../Dropbox/data' phae_path = data_path + '/price_hist_autoencoder' csv_in = '../price_history_03_seq_start_suddens_tri...
sahilm89/lhsmdu
lhsmdu/benchmark/.ipynb_checkpoints/Comparing LHSMDU and MC sampling - Large dimensions-checkpoint.ipynb
mit
import numpy as np import lhsmdu import matplotlib.pyplot as plt def simpleaxis(axes, every=False): if not isinstance(axes, (list, np.ndarray)): axes = [axes] for ax in axes: ax.spines['top'].set_visible(False) ax.spines['right'].set_visible(False) if every: ax.spine...
dib-lab/SSUsearch
notebooks-pc-linux/data-preparation.ipynb
bsd-3-clause
cd ~/Desktop/SSUsearch/ mkdir -p ./data cd ./data """ Explanation: Setup data directory End of explanation """ !wget https://s3.amazonaws.com/ssusearchdb/SSUsearch_db.tgz !tar -xzvf SSUsearch_db.tgz """ Explanation: Download database files End of explanation """ !wget https://s3.amazonaws.com/ssusearchdb/test....
abhi1509/deep-learning
autoencoder/Simple_Autoencoder.ipynb
mit
%matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', validation_size=0) """ Explanation: A Simple Autoencoder We'll start off by building a simple autoencoder to compres...
mdeff/ntds_2017
projects/reports/course_suggester/Data Cleaning.ipynb
mit
# Useful starting lines %matplotlib inline import numpy as np import scipy import scipy.sparse as sp import matplotlib.pyplot as plt import pandas as pd import re import nltk import string from time import time from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from sklearn.decomposition impo...
mjones01/NEON-Data-Skills
code/Python/remote-sensing/rgb-camera/plot-neon-rgb-camera-data.ipynb
agpl-3.0
import sys sys.version """ Explanation: syncID: 67a5e95e1b7445aca7d7750b75c0ee98 title: "Plotting a NEON RGB Camera Image (GeoTIFF) in Python" description: "This lesson is a brief introduction to RGB camera images and the GeoTIFF raster format in Python." dateCreated: 2018-06-30 authors: Bridget Hass, contributors: ...
mne-tools/mne-tools.github.io
0.23/_downloads/58e35821e0f211b843d5ead3e33d8849/20_sensors_time_frequency.ipynb
bsd-3-clause
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Stefan Appelhoff <stefan.appelhoff@mailbox.org> # Richard Höchenberger <richard.hoechenberger@gmail.com> # # License: BSD (3-clause) import os.path as op import numpy as np import matplotlib.pyplot as plt import mne from mne.time_frequenc...
dsavransky/MAE4060
Notebooks/Torque Free 3-1-3 Body Dynamics.ipynb
mit
aCi = rotMat(3,psi) cCa = rotMat(1,th) bCc = rotMat(3,ph) aCi,cCa,bCc bCi = bCc*cCa*aCi; bCi #3-1-3 rotation bCi_dot = difftotalmat(bCi,t,{th:thd,psi:psid,ph:phd}); bCi_dot """ Explanation: Set up rotation matrices representing a 3-1-3 $(\psi,\theta,\phi)$ Euler angle set. End of explanation """ omega_tilde = bCi*...
aparafita/news-similarity
notebooks/sgd.ipynb
gpl-3.0
folder = os.path.join('..', 'data') newsbreaker.init(os.path.join(folder, 'topic_model'), 'topic_model.pkl', 'vocab.txt') entries = load_entries(folder) entries_dict = defaultdict(list) for entry in entries: entries_dict[entry.feed].append(entry) client = MongoClient() db = client.newstagger """ Explanation: ...
daniestevez/jupyter_notebooks
dslwp/DSLWP GMSK SSDV pic11.ipynb
gpl-3.0
%matplotlib inline import numpy as np import scipy.signal import matplotlib.pyplot as plt fs = 40000 # sample rate """ Explanation: Recovering SSDV image 0xAB, transmitted on 2019-02-27 08:20 End of explanation """ skip = 3200 * fs * 8 # first transmission seems to have a missing samples from the recorder skip = 5...
jobovy/misc-notebooks
apogee/AtmosphereSynthesisInconsistency.ipynb
bsd-3-clause
atm= atlas9.Atlas9Atmosphere(teff=3500.,logg=2.5,metals=0.,am=0.,cm=0.) synspec_correct= apogee.modelspec.turbospec.synth(modelatm=atm, linelist='20150714', lsf='all',cont='true',vmacro=0., ...
zhaojijet/UdacityDeepLearningProject
image-classification/dlnd_image_classification.ipynb
apache-2.0
""" DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE """ from urllib.request import urlretrieve from os.path import isfile, isdir from tqdm import tqdm import problem_unittests as tests import tarfile cifar10_dataset_folder_path = 'cifar-10-batches-py' class DLProgress(tqdm): last_block = 0 def hoo...
sujitpal/polydlot
src/tensorflow/05b-experiment-from-keras.ipynb
apache-2.0
from __future__ import division, print_function from tensorflow.contrib.learn.python.learn.estimators import model_fn as model_fn_lib from tensorflow.contrib import keras import matplotlib.pyplot as plt import numpy as np import os import shutil import tensorflow as tf DATA_DIR = "../../data" TRAIN_FILE = os.path.join...
OpenWeavers/openanalysis
doc/Langauge/11- Inbuilt Data Structures 6 - Comprehensions and Lambdas.ipynb
gpl-3.0
num = [10,8,3,5,2,7,0,1,4,9,6] num def square_classic_approach(x): """ Input: x - List of Integers Return: A list containing squares of each element of list """ squared = [] # Empty list for i in range(len(num)): # Equivalent to for(i=0;i<num;i++) squared.append(num[i]**2) # Power ...
tensorflow/docs-l10n
site/en-snapshot/hub/tutorials/cord_19_embeddings.ipynb
apache-2.0
# Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
Naereen/notebooks
Prise de rdv automatique sur Doctolib.ipynb
mit
URL = "https://partners.doctolib.fr/hopital-public/perigueux/vaccination-covid?speciality_id=5494&enable_cookies_consent=1" from selenium import webdriver try: print(f"Downloading '{URL}'...") firefoxOptions = webdriver.FirefoxOptions() firefoxOptions.headless = True browser = webdriver.Firefox(option...
saashimi/code_guild
interactive-coding-challenges/staging/sorting_searching/group_ordered/group_ordered_challenge.ipynb
mit
def group_ordered(list_in): # TODO: Implement me pass """ Explanation: <small><i>This notebook was prepared by wdonahoe. Source and license info is on GitHub.</i></small> Challenge Notebook Problem: Implement a function that groups identical items based on their order in the list. Constraints Test Cases Algor...
tpin3694/tpin3694.github.io
statistics/demonstrate_the_central_limit_theorem.ipynb
mit
# Import packages import pandas as pd import numpy as np # Set matplotlib as inline %matplotlib inline """ Explanation: Title: Demonstrate The Central Limit Theorem Slug: demonstrate_the_central_limit_theorem Summary: Python introduction to the central limit theorem Date: 2016-05-01 12:00 Category: Statistics Tags:...
molgor/spystats
notebooks/Sandboxes/Sketches2_for_geopystats.ipynb
bsd-2-clause
plotdata_path = "/RawDataCSV/idiv_share/plotsClimateData_11092017.csv" empirical_data_path = "/apps/external_plugins/spystats/HEC_runs/results/logbiomas_logsppn_res.csv" """ Explanation: Sketches for automating spatial models This notebook is for designing the tool box and methods for fitting spatial data. I´m using t...
M-R-Houghton/euroscipy_2015
scikit_image/lectures/solutions/012_solutions.ipynb
mit
import matplotlib.pyplot as plt import numpy as np """ Explanation: Color and exposure End of explanation """ import skdemo from skimage import data color_image = data.chelsea() red_image = np.zeros_like(color_image) green_image = np.zeros_like(color_image) blue_image = np.zeros_like(color_image) red_image[:, :, 0...
datactive/bigbang
examples/experimental_notebooks/EME Diversity Analysis.ipynb
mit
import bigbang.ingress.mailman as mailman import bigbang.analysis.process as process from bigbang.archive import Archive import pandas as pd import datetime from commonregex import CommonRegex import matplotlib.pyplot as plt %matplotlib inline """ Explanation: This work was done by Harsh Gupta as part of his inter...
amitkaps/machine-learning
time_series/2-Acquire.ipynb
mit
# Import the library we need, which is Pandas import pandas as pd # Read all the tables from the html document AllTables = pd.read_html('MonthWiseMarketArrivalsJan2016.html') # Let us find out how many tables has it found? len(AllTables) type(AllTables) """ Explanation: 2. Acquire the Data Finding Data Sources The...
jseabold/statsmodels
examples/notebooks/statespace_concentrated_scale.ipynb
bsd-3-clause
import numpy as np import pandas as pd import statsmodels.api as sm dta = sm.datasets.macrodata.load_pandas().data dta.index = pd.date_range(start='1959Q1', end='2009Q4', freq='Q') """ Explanation: State space models - concentrating the scale out of the likelihood function End of explanation """ class LocalLevel(sm...
ecervera/Baxter-Vision
02 Compute Items SIFT Features.ipynb
mit
import json from utils import load_items with open('parameters.json', 'r') as infile: params = json.load(infile) RESIZE_X = params['resize']['x'] RESIZE_Y = params['resize']['y'] ITEM_FOLDER = params['item_folder'] items = load_items(ITEM_FOLDER) """ Explanation: <a id="top"></a> Compute Items SIFT Features Fir...
jserenson/Python_Bootcamp
Range().ipynb
gpl-3.0
range(0,10) x =range(0,10) type(x) start = 0 #Default stop = 20 x = range(start,stop) x """ Explanation: range() In this short lecture we will be discussing the range function. We haven't developed a very deep level of knowledge of functions yet, but we can understand the basics of this simple (but extremely usefu...
timzhangau/ml_nano
practice_projects/imdb/IMDB_In_Keras.ipynb
mit
# Imports import numpy as np import keras from keras.datasets import imdb from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.preprocessing.text import Tokenizer import matplotlib.pyplot as plt %matplotlib inline np.random.seed(42) """ Explanation: Analyzing IMDB Data in...
ALEXKIRNAS/DataScience
CS231n/assignment2/TensorFlow.ipynb
mit
import tensorflow as tf import numpy as np import math import timeit import matplotlib.pyplot as plt %matplotlib inline from cs231n.data_utils import load_CIFAR10 def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=10000): """ Load the CIFAR-10 dataset from disk and perform preprocessing to...
agvergara/DatatonURJC
Day1/Lab_1_Pandas.ipynb
gpl-3.0
#Representar gráficas inline %matplotlib inline import matplotlib.pyplot as plt #Importe el módulo de pandas import pandas as pd diabetes = pd.read_csv("diabetes.csv", delimiter=';') print(diabetes) #Lea el documento diabetes.csv. Recuerde que el fichero debe estar en el mismo directorio en el que esté creando el #not...
jbogaardt/chainladder-python
docs/tutorials/deterministic-tutorial.ipynb
mit
# Black linter, optional %load_ext lab_black import pandas as pd import numpy as np import chainladder as cl import matplotlib.pyplot as plt import os %matplotlib inline print("pandas: " + pd.__version__) print("numpy: " + np.__version__) print("chainladder: " + cl.__version__) """ Explanation: Applying Determinist...
huseinzol05/Deep-Learning-Tensorflow
Bayesian-Optimization/bayesian-feedforward-iris.ipynb
mit
df = pd.read_csv('Iris.csv') df.head() x_data = df.iloc[:, :-1].values.astype(np.float32) y_datalabel = df.iloc[:, -1] y_data = LabelEncoder().fit_transform(df.iloc[:, -1]) onehot = np.zeros((y_data.shape[0], np.unique(y_data).shape[0])) for i in range(y_data.shape[0]): onehot[i, y_data[i]] = 1.0 x_train, x_...
google/applied-machine-learning-intensive
content/xx_misc/probability_and_statistics/colab.ipynb
apache-2.0
# 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 the L...
JannesKlaas/MLiFC
Week 2/Ch. 12 - Trees and Ensembles.ipynb
mit
import numpy as np import pandas as pd # Set seed for reproducability np.random.seed(42) import matplotlib.pyplot as plt # Supress warnings for better readability import warnings; warnings.simplefilter('ignore') # Load data df = pd.read_csv('processed_bank.csv',index_col=0) # Check that data is okay df.head() # Pro...
gvasold/gdp17
objekte/objekte_1.ipynb
apache-2.0
books = [ ("Klein, Bernd", "Einführung in Python", "Hanser", "3", 2017), ("Sweigart, Al", "Automate the Boring Stuff with Python", "No Starch Press", "1", 2015), ("Weigend, Michael", "Python", "mitp", "6., erw. Aufl.", 2016), ("Downey, Allen B.", "Programmieren lernen mit Python", "O'Reilly", "1", 2014)...
AllenDowney/ThinkBayes2
examples/btp01.ipynb
mit
from __future__ import print_function, division % matplotlib inline import warnings warnings.filterwarnings('ignore') import numpy as np from thinkbayes2 import Hist, Pmf, Cdf, Suite, Beta import thinkplot """ Explanation: Bayes Theorem Problems This notebook presents code and exercises from Think Bayes, second edi...
GoogleCloudPlatform/training-data-analyst
courses/machine_learning/deepdive2/production_ml/labs/samples/contrib/kubeflow-katib/early-stopping.ipynb
apache-2.0
# Update the PIP version. !python -m pip install --upgrade pip !pip install kfp==1.1.1 !pip install kubeflow-katib==0.10.1 """ Explanation: Kubeflow Pipelines with Katib component In this notebook you will: - Create Katib Experiment using random algorithm. - Use median stopping rule as an early stopping algorithm. - U...
goodwordalchemy/thinkstats_notes_and_exercises
code/chap02_distributions_notes.ipynb
gpl-3.0
import thinkstats2 hist = thinkstats2.Hist([1,2,2,3,5]) hist print hist.Freq(2) == hist[2] print hist[4] print hist.Values() for val in sorted(hist.Values()): print (val, hist.Freq(val)) for val, freq in hist.Items(): print (val, freq) import thinkplot thinkplot.Hist(hist) thinkplot.Show(xlabel='value', ylab...
SBRG/ssbio
docs/notebooks/I-TASSER and TMHMM Install Guide.ipynb
mit
import os import os.path as op """ Explanation: I-TASSER and TMHMM Install Guide This notebook provides a guide to installing I-TASSER and TMHMM in Binder, since these require you to register with your email and cannot be installed beforehand. End of explanation """ # Step 2 itasser_download_link = 'my_download_link...
liufuyang/deep_learning_tutorial
jizhi-pytorch-2/01_word_embedding/homework-Copy1.ipynb
mit
# 加载必要的程序包 # PyTorch的程序包 import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim # 数值运算和绘图的程序包 import numpy as np import matplotlib.pyplot as plt import matplotlib # 加载机器学习的软件包,主要为了词向量的二维可视化 from sklearn.decomposition import PCA #加载Word2Vec的...
pauliacomi/pyGAPS
docs/examples/alphas.ipynb
mit
# import isotherms %run import.ipynb # import the characterisation module import pygaps.characterisation as pgc """ Explanation: The $\alpha_s$ method Very similar to the t-plot method, the $\alpha_s$ method compares an isotherm on a porous material with one that was taken on a reference non-porous surface. The refer...
Chipe1/aima-python
learning_apps.ipynb
mit
from learning import * from probabilistic_learning import * from notebook import * """ Explanation: LEARNING APPLICATIONS In this notebook we will take a look at some indicative applications of machine learning techniques. We will cover content from learning.py, for chapter 18 from Stuart Russel's and Peter Norvig's b...
ethen8181/machine-learning
python/iterator/iterator.ipynb
mit
# code for loading the format for the notebook import os # path : store the current path to convert back to it later path = os.getcwd() os.chdir(os.path.join('..', '..', 'notebook_format')) from formats import load_style load_style(plot_style=False) os.chdir(path) # magic to print version %load_ext watermark %water...
arcyfelix/Courses
18-10-30-Think-Stats-by-Allen-B-Downey/Notes.ipynb
apache-2.0
from typing import List import numpy as np import pandas as pd from scipy import stats import matplotlib.pyplot as plt import sklearn % matplotlib inline """ Explanation: Notes for Think Stats by Allen B. Downey End of explanation """ sample = [1, 3, 5, 6] np.mean(sample) pd.DataFrame(sample).mean() """ Explanat...
ixkael/Delight
notebooks/Tutorial - getting started with Delight.ipynb
mit
%matplotlib inline import numpy as np import matplotlib.pyplot as plt import scipy.stats import sys sys.path.append('../') from delight.io import * from delight.utils import * from delight.photoz_gp import PhotozGP %cd .. """ Explanation: Tutorial: getting started with Delight We will use the parameter file "tests/pa...
probml/pyprobml
notebooks/misc/jax_md_parallel_tpu_example.ipynb
mit
!pip install -q git+https://www.github.com/google/jax-md import jax try: import jax.tools.colab_tpu jax.tools.colab_tpu.setup_tpu() except KeyError: import os jax.devices() import os import jax.numpy as np from jax import jit from jax import vmap, pmap import jax.numpy as jnp from jax import random fro...
w4zir/ml17s
lectures/lec09-logistic-regression-example.ipynb
mit
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from sklearn import neighbors df = pd.read_csv('datasets/exam_dataset1.csv', encoding='utf-8') n_neighbors = 5 X = np.array(df[['exam1','exam2']]) y = np.array(df[['admission']]).ravel() h = .02 # ste...
mfouesneau/pyphot
examples/astropy_QuickStart.ipynb
mit
%matplotlib inline import pylab as plt import numpy as np import sys sys.path.append('../') from pyphot import astropy as pyphot """ Explanation: pyphot - A tool for computing photometry from spectra Some examples are provided in this notebook Full documentation available at http://mfouesneau.github.io/docs/pyphot/ ...
CommonClimate/teaching_notebooks
GEOL351/ZeroD.ipynb
mit
%matplotlib inline # ensures that graphics display in the notebook import matplotlib import numpy as np import matplotlib.pyplot as plt import sys sys.path.append("./CoursewareModules") from ClimateUtilities import * # import Ray Pierrehumbert's climate utilities import phys import seaborn as sns """ Explanatio...
yyl/btc-price-analysis
notes/news_analysis.ipynb
gpl-2.0
score_data = pd.read_csv("../data/nyt_bitcoin_with_score.csv", index_col='time', parse_dates=[0], date_parser=lambda x: datetime.datetime.strptime(x, time_format)) score_data.head() """ Explanation: Weekly sentiment score analysis End of explanation """ score_data.sentiment.unique() score_data.gr...
mez/carnd
P3_behavioral_cloning/playground.ipynb
mit
zero_steering = drive_log_df[drive_log_df.steering == 0].sample(frac=0.9) drive_log_df = drive_log_df.drop(zero_steering.index) plt.figure(figsize=(10,4)) drive_log_df.steering.hist(bins=100, color='r') plt.xlabel('steering angle bins') plt.ylabel('counts') plt.show() print("Current Dataset Size: ", len(drive_log_df.s...
mayankjohri/LetsExplorePython
Section 2 - Advance Python/Chapter S2.01 - Functional Programming/06_Excercise.ipynb
gpl-3.0
names = ["Aalok", "Chandu", "Roshan", "Prashant", "Saurabh"] for i in range(len(names)): names[i] = hash(names[i]) print(names) """ Explanation: Excercise - Functional Programming Q: Try rewriting the code below as a map. It takes a list of real names and replaces them with code names produced using a more robus...
marcelomiky/PythonCodes
Intro ML Semcomp/semcomp17_ml/.ipynb_checkpoints/semcomp17_ml_tutorial-checkpoint.ipynb
mit
#essential imports import sys sys.path.insert(1,'utils') import numpy as np import matplotlib.pyplot as plt # display plots in this notebook %matplotlib nbagg import pandas as pd import ml_utils print(np.__version__) print(np.__file__) """ Explanation: This workshop describes an overview of machine learning. Basic con...