text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Doppler Solve: Two Components ## Setup ``` %matplotlib inline %run notebook_setup.py import starry from pathlib import Path starry_path = Path(starry.__file__).parents[0] starry.config.lazy = True starry.config.quiet = True import numpy as np import matplotlib.pyplot as plt import starry import george import pymc3...
github_jupyter
# General API quickstart ``` %matplotlib inline import numpy as np import theano.tensor as tt import pymc3 as pm import seaborn as sns import matplotlib.pyplot as plt sns.set_context('notebook') plt.style.use('seaborn-darkgrid') print('Running on PyMC3 v{}'.format(pm.__version__)) ``` ## 1. Model creation Models i...
github_jupyter
[Video](https://youtu.be/bA261BF0bdk) by Siraj Raval. [DGL at a Glance](https://docs.dgl.ai/tutorials/basics/1_first.html) documentation. ``` %matplotlib inline # Install DGL package !pip install dgl ``` .. currentmodule:: dgl DGL at a Glance ========================= **Author**: `Minjie Wang <https://jermainew...
github_jupyter
# Welcome to the OBD SDD BE! Today, the goal is to understand how a distributed system can be useful when dealing with medium to large scale data sets. We'll see that Dask start to be nice as soon as the Data we need to process doesn't quite fit in memory, but also if we need to launch several computations in parall...
github_jupyter
# Dependências ``` import os import re import unicodedata import random from enum import Enum import nltk import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.tree import DecisionTreeClassifier from sklearn.svm import SVC from sklea...
github_jupyter
### 파이썬 알고리즘 6장: 문자열 조작 #### 팰린드롬 앞뒤가 똑같은 단어나 문장으로, 뒤집어도 같은 단어 또는 문장을 팰린드롬이라고 한다. ``` def isPalindrome(s:str) -> bool: chars =[] for char in s: if char.isalnum(): chars.append(char.lower()) return chars == chars[::-1] #slicing을 통해 문자열을 뒤집어서 비교할 수 있다 s = 'race a car' isPalindrome(s) ``...
github_jupyter
# Encoders: Categorical Example For categorical input we can also force the output to be binary. ---- #### Note on the data set The data set used here is not particularly complex and/or big. It's not really all that challenging to find the fraud. In an ideal world we'd be using more complex data sets to show the rea...
github_jupyter
# Process CoMMpass Data In the following notebook, we process input RNAseq gene expression matrices for downstream machine learning applications. Prior to processing, the input expression matrix was FPKM normalized. We first calculate and visualize the per gene variability in the CoMMpass gene expression dataset. We ...
github_jupyter
``` # Jovian Commit Essentials # Please retain and execute this cell without modifying the contents for `jovian.commit` to work !pip install jovian --upgrade -q import jovian jovian.utils.colab.set_colab_file_id('17iO0rBs-gOFSUPbr6nd3IyfcKR-j2yYa') ``` # Cancer Mortality rate prediction for US counties using feedfowar...
github_jupyter
``` import pandas as pd, numpy as np from scipy import stats stations=pd.read_csv('data/stations.csv').set_index('ID') c='ro' df=pd.read_csv('data/'+c+'_ds.csv') #daily data # df=pd.read_csv('data/'+c+'_hs.csv') #high_res data df['time']=pd.to_datetime(df['time']) df['year']=df['time'].dt.year df['month']=df['time'].dt...
github_jupyter
<h1>Sustainable Energy Transitions</h1> <div>A project by <a href="http://www.ssgouridis.org" target="_blank" >Sgouris Sgouridis</a> and <a href="http://www.csaladen.es" target="_blank" >Dénes Csala</a> at <a href="http://www.masdar.ac.ae" target="_blank">Masdar Institute of Science and Technology</a></div> <h2><br>Pl...
github_jupyter
# Convolutional Neural Networks A CNN is made up of basic building blocks defined as tensor, neurons, layers and kernel weights and biases. In this lab, we use PyTorch to build a image classifier using CNN. The objective is to learn CNN using PyTorch framework. Please refer to the link below for know more about CNN htt...
github_jupyter
# Bayes' law Use Bayes’ law to calculate the probability of getting a data science job if you’ve gotten an interview for the job. This could be written P(get the DS job | interview). You’ll have to use Bayesian probability methods (your intuition or beliefs) to assign values to the different components of Bayes’ law. ...
github_jupyter
# 20장. 군집화 (Clustering) ## 1. K-평균 군집화 (K-means clustering) ``` from scratch.linear_algebra import Vector ``` ### 1.1 해밍 거리 (hamming distance) 두 벡터의 다른 값을 갖는 요소 개수 ``` def num_differences(v1: Vector, v2: Vector) -> int: assert len(v1) == len(v2) return len([x1 for x1, x2 in zip(v1, v2) if x1 != x2]) assert...
github_jupyter
### Configuration of the environment ``` %tensorflow_version 2.x !pip3 install --upgrade pip #!pip install -qU t5 !pip3 install git+https://github.com/google-research/text-to-text-transfer-transformer.git #extra_id_x support import functools import os import time import warnings warnings.filterwarnings("ignore", cate...
github_jupyter
With GPS-enabled devices, it's easy to collect a large quantity of trajectory data, i.e. a connected series of points in 2D or 3D. However, it's not so easy to plot large datasets with most plotting programs, and so people generally downsample the trajectories, which can hide important features of the data. Here we s...
github_jupyter
``` # Import the usual suspects. import pandas as pd ``` # Feature engineering for Resistance Profile ``` tbprofiler_df = pd.read_json("../data/raw/cohort.tbprofiler.json", encoding="UTF-8") tbprofiler_df = tbprofiler_df.transpose() tbprofiler_df.head() tbprofiler_df.shape resistance_status_df = tbprofiler_df resista...
github_jupyter
## Data and Model Preparation The following code prepares TF-IDF used by KEA approaches. Please modify input_dir and output_file as per your local setup. For more details please look at https://boudinfl.github.io/pke/build/html/tutorials/training.html ``` # -*- coding: utf-8 -*- import logging import sys from string...
github_jupyter
# Unit 9: LightFM You almost made it - this is the final lesson and it is also going to be the easiest one. As you may already assume - there are a lot of recommender packages in Python out there. In this lesson we will look at LightFM - an easy to use and lightweight implementation of different approaches and algori...
github_jupyter
[Sebastian Raschka](http://sebastianraschka.com), 2015 https://github.com/rasbt/python-machine-learning-book # Python Machine Learning - Code Examples # Chapter 13 - Parallelizing Neural Network Training with Theano Note that the optional watermark extension is a small IPython notebook plugin that I developed to ma...
github_jupyter
``` %load_ext autoreload %autoreload 2 from timeit import default_timer as timer from functools import partial from random import choices import logging import sdgym from sdgym import load_dataset from sdgym import benchmark from sdgym import load_dataset import numpy as np import pandas as pd import matplotlib.pyplot ...
github_jupyter
#### Copyright 2019 The TensorFlow Hub Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` # 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. #...
github_jupyter
<a href="https://colab.research.google.com/github/cateto/python4NLP/blob/main/ml_lec/cost_function.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import tensorflow.compat.v1 as tf tf.disable_v2_behavior() import matplotlib.pyplot as plt X = [1...
github_jupyter
### 1- Check GPU type ``` !nvidia-smi ``` ### 2- Install SimpleRepresentations library ``` !pip install simplerepresentations ``` ### 3- Download the Large Movie Review Dataset ``` !wget https://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz !tar xzf aclImdb_v1.tar.gz !rm aclImdb_v1.tar.gz ``` ### 4- Loa...
github_jupyter
# Smart Queue Monitoring System - Transportation Scenario ## Overview Now that you have your Python script and job submission script, you're ready to request an edge node and run inference on the different hardware types (CPU, GPU, VPU, FPGA). After the inference is completed, the output video and stats files need to...
github_jupyter
# Decision Trees and Random Forests in Python **Learning Objectives** 1. Explore and analyze data using a Pairplot 2. Train a single Decision Tree 3. Predict and evaluate the Decision Tree 4. Compare the Decision Tree model to a Random Forest ## Introduction In this lab, you explore and analyze data using a Pai...
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@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 ...
github_jupyter
``` import datat_duocpu import argparse import logging logger = logging.getLogger() import win_unicode_console win_unicode_console.enable() def init_logger(log_file=None, log_file_level=logging.NOTSET): log_format = logging.Formatter("[%(asctime)s %(levelname)s] %(message)s")#上面的%Y等是时间格式 logger = logging.getLo...
github_jupyter
<img alt="QuantRocket logo" src="https://www.quantrocket.com/assets/img/notebook-header-logo.png"> <a href="https://www.quantrocket.com/disclaimer/">Disclaimer</a> # Zipline Strategy Code The strategy code is provided in [winners.py](winners.py). ## Install strategy file To "install" the strategy, execute the foll...
github_jupyter
# [Hashformers](https://github.com/ruanchaves/hashformers) Hashformers is a framework for hashtag segmentation with transformers. For more information, please check the [GitHub repository](https://github.com/ruanchaves/hashformers). # Installation Here we install `mxnet-cu110` and `hashformers`. `mxnet-cu110` is co...
github_jupyter
# Writing custom Jaxpr interpreters in JAX JAX offers several composable function transformations (`jit`, `grad`, `vmap`, etc.) that enable writing concise, accelerated code. Here we show how to add your own function transformations to the system, by writing a custom Jaxpr interpreter. And we'll get composability wi...
github_jupyter
## 1. Setup ``` import sys sys.path.append('../..') import config import matplotlib.pyplot as plt import numpy as np import os import warnings from keras.callbacks import ModelCheckpoint, Callback, TensorBoard from neural_networks.unet import UNet from neural_networks.keras_utils import EvalMetricsCallback from utils...
github_jupyter
``` import altair as alt import pandas as pd alt.renderers.enable('png') #alt.renderers.enable('mimetype') # import briefings with calculated emotion and topic values briefings_df = pd.read_csv('../data/topic_scored_briefings.csv') briefings_df briefings_df.describe() emotions_df = briefings_df.drop(columns=['tb_polari...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@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 ...
github_jupyter
# MAGIC Gamma Telescope - TPOT Classification Study The below gives information about the data set: The data are MC generated (see below) to simulate registration of high energy gamma particles in a ground-based atmospheric Cherenkov gamma telescope using the imaging technique. Cherenkov gamma telescope observes high...
github_jupyter
# Installation - Run these commands - git clone https://github.com/Tessellate-Imaging/Monk_Object_Detection.git - cd Monk_Object_Detection/3_mxrcnn/installation - Select the right requirements file and run - cat requirements_cuda9.0.txt | xargs -n 1 -L 1 pip install # Monk Format ...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@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 ...
github_jupyter
# Plots for years experiments Python code to generate the plots from the matlab experiments. ``` import scipy.io as spio import matplotlib.pyplot as plt import matplotlib %matplotlib inline #matplotlib.rcParams['ps.useafm'] = True #matplotlib.rcParams['pdf.use14corefonts'] = True #matplotlib.rcParams['text.usetex'] = ...
github_jupyter
Currently, Canadian/US phone numbers having the following format are supported as valid input: * Country code of "1" (optional) * Three-digit area code (optional) * Three-digit central office code * Four-digit station code * Extension number preceded by "#", "x", "ext", or "extension" (optional) A combination of numb...
github_jupyter
<a href='http://www.holoviews.org'><img src="assets/hv+bk.png" alt="HV+BK logos" width="40%;" align="left"/></a> <div style="float:right;"><h2>04. Exploration with Containers</h2></div> In the first two sections of this tutorial we discovered how to declare static elements and compose them one by one into composite ob...
github_jupyter
Below, you will find a series of methods that I (NG) tried to install Dedalus on Graham. Not all work, but some do. Raw cells can be directly copied-and-pasted. # Using Graham's native modules ## The version that is currently (Dec. 2019) running ### Installation Thanks to Julio/Jose Fuentes from McGill. Create a d...
github_jupyter
Our data generator will have three components. First, we define the link between the "magic" integer ids and the object attributes (e.g. name, location, etc. of activities in EXIOBASE). This will be in a Pandas dataframe. ``` import pandas as pd df = pd.DataFrame([ {'index': 0, 'name': 'foo', 'location': 'CH'}, ...
github_jupyter
# SNLP Assignment 4 Name 1: Nikhil Paliwal<br/> Student id 1: 7009915<br/> Email 1: nipa00002@stud.uni-saarland.de<br/> Name 2: Sangeet Sagar<br/> Student id 2: 7009050<br/> Email 2: sasa00001@stud.uni-saarland.de<br/> **Instructions:** Read each question carefully. <br/> Make sure you appropriately comment your c...
github_jupyter
``` %pylab inline ``` # Annotation (`pyannote.core.annotation.Annotation`) ``` from pyannote.core import Annotation ``` **`Annotation`** instances are used to describe sets of annotated temporal fragments. For instance, one can use an **`Annotation`** to store the result of speaker identification approach applied...
github_jupyter
## 贝叶斯分类基本原理 ### 贝叶斯定理: 条件概率公式 $$ P(A|B) = \dfrac{P(AB)}{P(B)} $$ 贝叶斯定理 $$ P(B_i|A)=\dfrac{P(A|B_i)P(B_i)}{\sum\limits_j P(A|B_j)P(B_j)} $$ 假设有N种可能的类别标记$\{c_1,c_2,...,c_N\}$,$P(c_i|\textbf{x})$,将样本x标记为$c_i$的后验概率 $$ P(c|\textbf{x})=\dfrac{P(\textbf{x},c)}{P(\textbf{x})}=\dfrac{P(c)P(\textbf{x}|c)}{P(\textbf{x})} ...
github_jupyter
# Classification Exercise We'll be working with some California Census Data, we'll be trying to use various features of an individual to predict what class of income they belogn in (>50k or <=50k). Here is some information about the data: <table> <thead> <tr> <th>Column Name</th> <th>Type</th> <th>Description</th> ...
github_jupyter
# REIFF Regression Estimated Iterative Football Forecaster ``` from __future__ import division from pandas import concat, read_csv, to_datetime from ggplot import * from sklearn import linear_model import pandas as pd import numpy as np from numpy import floor, histogram from scipy import stats from scipy.stats impor...
github_jupyter
# Unit 3: Demographic Recommendations In this section we leave the boring field of unpersonalized content and do our first steps for more personalization. But, before tailoring content to individuals we first tailor content to groups of individuals that by some criteria seem to be similar and therefore - assumed to - ...
github_jupyter
# Non-linear Gaussian filtering and smoothing Provided are two examples of nonlinear state-space models on which one can perform Bayesian filtering and smoothing in order to obtain a posterior distribution over a latent state trajectory based on noisy observations. In order to understand the theory behind these method...
github_jupyter
# Nonlinear Regression in [`SciPy`](https://docs.scipy.org/doc/scipy/reference/) and [R](https://www.r-project.org/about.html) We often need to find a function $y=f(x,\beta)$ of variable $x$ and $p$ unknown parameters $\beta$ which fits a given set of $n$ predictor, {$x_1,...,x_n$}, and response, {$y_1,...,y_n$}, valu...
github_jupyter
# TensorFlow Tutorial #02 # Convolutional Neural Network by [Magnus Erik Hvass Pedersen](http://www.hvass-labs.org/) / [GitHub](https://github.com/Hvass-Labs/TensorFlow-Tutorials) / [Videos on YouTube](https://www.youtube.com/playlist?list=PL9Hr9sNUjfsmEu1ZniY0XpHSzl5uihcXZ) ## Introduction The previous tutorial sho...
github_jupyter
$$\frac{\partial u}{\partial t} + a \frac{\partial u}{\partial x} = 0$$ ``` import numpy #here we load numpy from matplotlib import pyplot #here we load matplotlib %matplotlib inline # Euler adelante nx = 201 dx = 2 / (nx-1) nt = 100 #nt is the number of timesteps we want to calculate d...
github_jupyter
## Analyze Logs of Evaluation Runs - Copy the AWS RoboMaker evaluation simulation identification number. - AWS SageMaker training job saves checkpoint and frozen graphs into an S3 model bucket. Copy the bucket and prefix from your training job. ``` s3_bucket = 'FILL_HERE' s3_prefix = 'FILL_HERE' ``` ## Imports ```...
github_jupyter
# Train a dataset from Interface 2018/12 with Keras - Unlike small book image dataset, it was little bit harder to fine-tune parameters. - Similar accuracy with fast.ai could be achieved, but spent a lot more effort. Using fast.ai library would be the shortest path to reach the goal. ``` ##### import warnings warnin...
github_jupyter
``` %%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?fa...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All). Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we...
github_jupyter
# Week 3: Project - ✅ Were you able to create new models to answer the data questions on conversion rate? - ✅ Were you able to add a new macro to your dbt project? (`grant`, `sum_if`) - ✅ Were you able to add a post hook to your project to apply grants to the role "reporting"? - ✅ Were you able to install a package? (...
github_jupyter
<a href="https://colab.research.google.com/github/r-dube/fakejobs/blob/main/fj_roc_auc.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` # Load the modules used import numpy as np import scipy as sci import pandas as pd from sklearn.metrics import...
github_jupyter
# 2D map fitting ## Prerequisites: - To understand how a generel modelling and fiiting works in gammapy, please refer to the [analysis_3d tutorial](analysis_3d.ipynb) ## Context: We often want the determine the position and morphology of an object. To do so, we don't necessarily have to resort to a full 3D fitting b...
github_jupyter
``` # default_exp config %load_ext autoreload %autoreload 2 ``` # Config File Handling > We create a default blocklist.yaml file that stores the blocked URLs. It can be edited with command line arguments. ``` #export import yaml DEFAULT_URLS = ["twitter.com", "youtube.com", "facebook.com", "instagram.com", "red...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt ``` This notebook explores the background of the Kalman filter. # Weighting the past against the present The central idea of the Kalman filter is to weight the past against the present. We're actually very familiar with this idea and ues it whenever averaging or...
github_jupyter
# Delta Method Code for reproducing all the results in the paper _The Delta-method and influence function in epidemiology: a reproducible tutorial_ ### Authors Rodrigo Zepeda-Tello 1| Michael Schomaker 2,3| Aurelien Belot 4| Camille Maringe 4| Mathew Smith 4| Bernard Rachet 4| Mireille E.Schnitzer 5,6| Miguel Ange...
github_jupyter
# 常见的优化操作和优化算法 ## 1. 标准化 Normalization ### 1.1 标准化输入 Normalizing inputs 对输入做标准化其实就是三个步骤: 1. 求训练集 $X_{train}$ 的均值 $\mu$ 和标准差 $\sigma$ 2. $\frac{X_{train}-\mu}{\sigma}$ 3. $\frac{X_{test}-\mu}{\sigma}$ 做这一步的时候唯一要注意的就是求均值和标准差的方向。 ``` import numpy as np ``` 随机生成一个7行5列的 array ,表示一个有7个样本5个特征的数据集 ``` X = np.random.r...
github_jupyter
#### Reinforcement Learning Agent to play **Frozen Lake** Game! **Game Rules:** - We are in a 3x3 grid world which is 0-indexed. - Starting from (0,0), Player should move in the grid inorder to maximise the reward. - The player will receive a reward of +1 if he enters the grid numbered with 4/6 ( Treasure ). - The pla...
github_jupyter
``` from __future__ import print_function, absolute_import, with_statement # from IPython import display as ipythondisplay import tensorflow as tf # tf.enable_eager_execution() import matplotlib.pyplot as plt %matplotlib inline import numpy as np import cv2 import os # Import plot utilities from dl_utils import myplo...
github_jupyter
# Задание 3.1 - Сверточные нейронные сети (Convolutional Neural Networks) Это последнее задание на numpy, вы до него дожили! Остался последний марш-бросок, дальше только PyTorch. В этом задании вы реализуете свою собственную сверточную нейронную сеть. ``` import numpy as np import matplotlib.pyplot as plt %matplotl...
github_jupyter
From : https://docs.python.org/3.6/reference/index.html ``` import os os.getpid() import inspect import hybridcuda cures = hybridcuda.initcuda() hybridcuda.registerheader("hybpython.cuh", os.getcwd() + os.sep + ".." + os.sep + ".." + os.sep + "hybpython.cuh") assert cures == 0 class hybridkernel: gridDimX = 1 ...
github_jupyter
``` from kamodo.kamodo import Kamodo ``` ## LaTeX support Kamodo supports both python and LaTex-formatted expressions as input. For LaTeX, you must wrap your expression in ```$ $```: ``` Kamodo(f = 'x**2 + y**2', g = '$2x^2 + 3y^2$') ``` ## Conventions Kamodo's variable names have to follow python's naming conventio...
github_jupyter
# Production Management Model **Randall Romero Aguilar, PhD** This demo is based on the original Matlab demo accompanying the <a href="https://mitpress.mit.edu/books/applied-computational-economics-and-finance">Computational Economics and Finance</a> 2001 textbook by Mario Miranda and Paul Fackler. Original (Matlab...
github_jupyter
# Regression *Supervised* machine learning techniques involve training a model to operate on a set of *features* and predict a *label* using a dataset that includes some already-known label values. The training process *fits* the features to the known labels to define a general function that can be applied to new feat...
github_jupyter
# Create Your Own Cognitive Portrait ## Technique: Circular Faces Hello! Let's create some **Science Art** together with this **Cogntivie Portrait** challenge! This is short notebook with mostly the code, you can view more detailed instructions in `CognitivePortrait.ipynb`. ``` import sys !{sys.executable} -m pip in...
github_jupyter
``` import logging from tfprop_vis import ViewTFP, potential_func, kmeans_clust import tfprop_som as tfpsom import pandas as pd import matplotlib.pyplot as plt import numpy as np import ipywidgets as widgets # may a pox befall the sompy dev who put logging configuration inside a programming library logging.getLogger()...
github_jupyter
# T81-558: Applications of Deep Neural Networks **Module 5: Regularization and Dropout** * Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx) * For more information visit the [cla...
github_jupyter
# Testing ML architectures implemented on the MLTSA package In this packaged there are multiple architectures built in for testing on the different data available ``` """First we import our dataset examples, and as usual generate data to work with""" from OneD_pot_data import potentials from OneD_pot_data import data...
github_jupyter
# TME 8: Split > Consignes: le fichier TME8_Sujet.ipynb est à déposer sur le site Moodle de l'UE https://moodle-sciences.upmc.fr/moodle-2019/course/view.php?id=4248. Si vous êtes en binôme, renommez-le en TME8_nom1_nom2.ipynb. N'oubliez pas de sauvegarder fréquemment votre notebook !! ``` from PIL import Image from p...
github_jupyter
``` import warnings, gc import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from sklearn.metrics import auc, roc_curve from sklearn.preprocessing import LabelEncoder # h2o modules import h2o from h2o.frame import H2OFrame from h2o.grid.grid_search import H2OGridSearch from h2o....
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@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 ...
github_jupyter
``` from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import gc from os.path import join as ospath import tensorflow as tf # from .utils import * from tensorflow.keras.layers import Input,Flatten,Reshape,Dense, Lambda from tensorflow.keras.l...
github_jupyter
# Demo Script for ERDDAP transformations Take Mooring Timeseries data and grid to 1hr so parameter(time,depth) - which is 1hr, 1m traditionally for EcoFOCI. Do not interpolate in depth. Use ERDDAP as datasource Take CTD Collection of casts and grid ? (is this useful - not really) **designed with akutan in mind** ...
github_jupyter
# Customizing datasets in fastai ``` from fastai import * from fastai.gen_doc.nbdoc import * ``` In this tutorial, we'll see how to create custom subclasses of [`ItemBase`](/core.html#ItemBase) or [`ItemList`](/data_block.html#ItemList) while retaining everything the fastai library has to offer. To allow basic functi...
github_jupyter
# SageMaker PySpark XGBoost MNIST Example 1. [Introduction](#Introduction) 2. [Setup](#Setup) 3. [Loading the Data](#Loading-the-Data) 4. [Training and Hosting a Model](#Training-and-Hosting-a-Model) 5. [Inference](#Inference) 6. [More on SageMaker Spark](#More-on-SageMaker-Spark) ## Introduction This notebook will s...
github_jupyter
``` public abstract class Room { abstract void connect(Room room); } public abstract class MazeGame { private final List<Room> rooms = new ArrayList<>(); public MazeGame() { Room room1 = makeRoom(); Room room2 = makeRoom(); room1.connect(room2); rooms.add(room1); ...
github_jupyter
``` #import needed modules import os import pandas as pd pd.set_option('display.max_rows', 200) import numpy as np import matplotlib.pyplot as plt from statsmodels.graphics.gofplots import qqplot from scipy.stats import boxcox from sklearn.linear_model import LinearRegression, RidgeCV, Ridge, LassoCV from datetime impo...
github_jupyter
# Transfer Learning With certain data types it is possible to use the weights learned in one task to be **transferred** to another task. For example in a task that is used to detect Animals and Vehicles in images (as done in CIFAR10) could be reused to classify dogs and cats. Transfer Learning is heavily used in Ima...
github_jupyter
# SNRM Extension Steindl ## Preparations: * Checkout original snrm code with extended functions * download datasets, embedding * extract download files * move required data files in project directory * setup anaconda with package dependencies **Google Colab Runtime Type** Set `Runtime -> Change Runtime t...
github_jupyter
# About: Simple Hivemall query for Test --- Hivemallの動作確認として、 [a9a binary classification](https://github.com/myui/hivemall/wiki#a9a-binary-classification) で示されたLogistic Regressionの動作確認をしてみる。 ## *Operation Note* *This is a cell for your own recording. ここに経緯を記述* # Notebookと環境のBinding Inventory中のgroup名でBind対象を指示する。...
github_jupyter
# Multiscale Object Detection :label:`sec_multiscale-object-detection` In :numref:`sec_anchor`, we generated multiple anchor boxes centered on each pixel of an input image. Essentially these anchor boxes represent samples of different regions of the image. However, we may end up with too many anchor boxes to compu...
github_jupyter
# Project Milestones --------------- ## Mar. 24, Milestone 1 |Deliverable | Percent Complete | Estimated Completion Date | Percent Complete by Next Milestone | |-----------:|-----------------:|---------------:|-----------:| |Code | 30%| Apr 2| 75% | |Paper| 10%| Apr 21| 30%| |De...
github_jupyter
# Custom Estimator with Keras **Learning Objectives** - Learn how to create custom estimator using tf.keras ## Introduction Up until now we've been limited in our model architectures to premade estimators. But what if we want more control over the model? We can use the popular Keras API to create a custom model....
github_jupyter
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline ``` # Create ...
github_jupyter
# Grouping and sorting reference This is the reference component to the "Grouping and sorting" section of the Advanced Pandas track. ``` import pandas as pd reviews = pd.read_csv("../input/wine-reviews/winemag-data-130k-v2.csv", index_col=0) pd.set_option("display.max_rows", 5) ``` Grouping is so important that it h...
github_jupyter
``` import duet import numpy as real_numpy from duet import pandas as pd from duet import numpy as np from duet import map from duet import L2 from duet import LInf from duet import zip import matplotlib.pyplot as plt import urllib.request import os epsilon = 1.0 alpha = 10 if not os.path.exists('../data_long/'):...
github_jupyter
# Description Runs hierarchical clustering on the umap version of the data. # Environment variables ``` from IPython.display import display import conf N_JOBS = conf.GENERAL["N_JOBS"] display(N_JOBS) %env MKL_NUM_THREADS=$N_JOBS %env OPEN_BLAS_NUM_THREADS=$N_JOBS %env NUMEXPR_NUM_THREADS=$N_JOBS %env OMP_NUM_THREA...
github_jupyter
# Decision Trees and Random Forests in Python **Learning Objectives** 1. Explore and analyze data using a Pairplot 2. Train a single Decision Tree 3. Predict and evaluate the Decision Tree 4. Compare the Decision Tree model to a Random Forest ## Introduction In this lab, you explore and analyze data using a Pai...
github_jupyter
``` import xarray as xr import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.ndimage import gaussian_filter import yaml from os.path import join from hwtmode.data import load_patch_files, min_max_scale, storm_max_value, get_meta_scalars, combine_patch_data import cartopy.crs as ccrs import ...
github_jupyter
``` import nltk import difflib import time import gc import itertools import multiprocessing import pandas as pd import numpy as np import xgboost as xgb import lightgbm as lgb import warnings warnings.filterwarnings('ignore') import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns from sklearn.metri...
github_jupyter
``` import argparse import json import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from datetime import datetime _version = int(datetime.now().strftime("%s")) def init_flags(): global FLAGS parser = argparse.ArgumentParser() parser.add_argument("--rundir", default="./runs...
github_jupyter
# TensorFlow Tutorial #17 # Estimator API by [Magnus Erik Hvass Pedersen](http://www.hvass-labs.org/) / [GitHub](https://github.com/Hvass-Labs/TensorFlow-Tutorials) / [Videos on YouTube](https://www.youtube.com/playlist?list=PL9Hr9sNUjfsmEu1ZniY0XpHSzl5uihcXZ) ## WARNING! **This tutorial does not work with TensorFlo...
github_jupyter
``` import pandas as pd import numpy as np import os import datetime def edit_column_date(frame,index): #Edits the date format of columns of dataframes #index: index of the first column of dates + 1 i = 0 for col in frame: i += 1 if i >= index: new_d = date_format(col) ...
github_jupyter