text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## The max value entropy search acquisition function Max-value entropy search (MES) acquisition function quantifies the information gain about the maximum of a black-box function by observing this black-box function $f$ at the candidate set $\{\textbf{x}\}$ (see [1, 2]). BoTorch provides implementations of the MES acq...
github_jupyter
# Spreadsheet Make a spreadsheet using pinkfish. This is useful for developing trading strategies. It can also be used as a tool for buy and sell signals that you then manually execute. ``` import datetime import matplotlib.pyplot as plt import pandas as pd from talib.abstract import * import pinkfish as ...
github_jupyter
Analysis of the Coalescent Simulation ===================================== ``` library(ggplot2) library(plyr) library(reshape2) ``` Dataset ------- This is the summary of Spearman's $\rho$ over 10 replicates of the "coalescent" experiment ``` stats = read.csv("overall.csv") stats$rep = as.factor(sort(rep(1:10, tim...
github_jupyter
Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality using cross-validation. ROC curves typically feature true positive rate on the Y axis, and false positive rate on the X axis. This means that the top left corner of the plot is the “ideal” point - a false positive rate of z...
github_jupyter
# Overview * Goal * simulating emperical SIP data from validation experiments * SIP validations consisted of one or a few genomes * Existing datasets * Lueders et al., 2004 (barkeri vs extorquens) * Lueders T, Manefield M, Friedrich MW. (2004). Enhanced sensitivity of DNA- and rRNA-based stable isotope pr...
github_jupyter
# Qurro QIIME 2 "Moving Pictures" Tutorial In this tutorial, we'll demonstrate the process of using [Qurro](https://github.com/biocore/qurro) to investigate a compositional biplot generated by [DEICODE](https://github.com/biocore/DEICODE/). ## 0. Introduction ### 0.1. What is Qurro? Lots of tools for analyzing " 'o...
github_jupyter
# Example queries for Case Counts on COVID-19 Knowledge Graph [Work in progress] This notebook demonstrates how to run Cypher queries to retrieve and aggregate COVID-19 case counts. COVID-19 case numbers are provided by: Country and US County level data: [JHU](https://github.com/covid-19-net/covid-19-community/blob/...
github_jupyter
``` import sys import pandas as pd import numpy as np from sklearn import preprocessing import matplotlib.pyplot as plt import matplotlib.mlab as mlab import plotly.plotly as py import plotly.graph_objs as go import plotly.offline as offline from sklearn.manifold import TSNE offline.init_notebook_mode(connected=True)...
github_jupyter
# Continuous Control --- In this notebook, you will learn how to use the Unity ML-Agents environment for the second project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program. ### 1. Start the Environment We begin by importing the ne...
github_jupyter
``` from random import shuffle import numpy from scipy import stats def truncate(a, b): n = min(len(a), len(b)) return a[:n], b[:n] def truncate3(a, b, c): n = min(len(a), len(b), len(c)) return a[:n], b[:n], c[:n] def xor(x, y): # assert len(x) == len(y) a = int.from_bytes(x, "big") b =...
github_jupyter
# Algorithms of graph ``` import sys import matplotlib.pyplot as plt #change it to your path BaseAlgPath = "/home/xuhangkun/Code/BaseAlgorithm" sys.path.append(BaseAlgPath) #draw the draph import random def DrawGraph(gr,color="blue",directed=False,**kwargs): """draw undirected graph """ points = [] for...
github_jupyter
<a href="https://colab.research.google.com/github/AJamal27891/1YBCwVpt3HNYOiYL/blob/main/ConvBert_Matching_entities.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # download dependencies ``` !rm -r test_trainer !pip install transformers !pip inst...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import statsmodels.api as sm from sklearn.linear_model import LinearRegression import sys sys.path.insert(0, '../') from portfolio import * ``` # Load Data ``` rets = pd.read_excel('../data/sp500_fundamentals.xlsx',sheet_name='total returns...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/6_freeze_base_network/2.1)%20Understand%20the%20effect%20of%20freezing%20base%20model%20in%20transfer%20learning%20-%202%20-%20mxnet.ipynb" target="_parent"><img src="https://colab.researc...
github_jupyter
# Pathing Based on flexible logarithmic spiral The polar equation of a logarithmic spiral is written as r=e^(a*theta), where r is the distance from the origin, e is Euler's number (about 1.618282), and theta is the angle traveled measured in radians (1 radian is approximately 57 degrees) The constant a is the...
github_jupyter
## Illusory contours, intensity/exposure invariance, no need for precision weighting! Scaling input signal's intensity, not value, e.g. a dim or bright sin wave between 1 and -1. ``` # %% import torch from torch import nn import pdb import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np...
github_jupyter
# Histograms of Oriented Gradients (HOG) There are several algorithms used to detect objects in a picture. Those algorithms work well for detecting consistent internal features, such as facial detection, because faces have a lot of consistent internal features that don’t get affected by the image background, such as t...
github_jupyter
--- --- # Born Machine through MPS ## Algorithm --- #### Legend: * <font color='blue'>blue</font> means there is still some doubts about the procedure. * <font color='green'>green</font> means there are some details further discussed about the argument. ***Goal :*** Obtain a wavefunction ${\psi}$ expressed through a ...
github_jupyter
# Facies classification from well logs with Convolutional Neural Networks (CNN) ## Shiang Yong Looi Using Keras running on top for Tensorflow, we build two CNNs : first to impute PE on two wells with missing data and then for the main task of classifying facies. ``` import numpy as np import pandas import matplotlib...
github_jupyter
# Master equation We consider a system made of states $A$, $B$, $C$, ... Each state has a given equilibrium population and the transition rate between any two states can be non-zero and is fixed. The population of any state at any time is stored in the vector $P$. The transition rates are stored in matrix $M$. The evo...
github_jupyter
# Wrangle OpenStreetMap data [Cédric Campguilhem](https://github.com/ccampguilhem/Udacity-DataAnalyst), August 2017 <a id="Top"/> ## Table of contents - [Introduction](#Introduction) - [Project organisation](#Project organisation) - [Map area selection](#Area selection) - [XML data structure](#XML data structure) - [...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') !wget http://www.iapr-tc11.org/dataset/4NSigComp2010/Dataset_4NSigComp2010.zip #maybe play with this later? For submission to ark. import zipfile z = zipfile.ZipFile('/content/sigComp2011-trainingSet.zip', 'r') z.setpassword(b"I hereby accept the SigComp...
github_jupyter
# __DATA 5600: Introduction to Regression and Machine Learning for Analytics__ ## __Notes on the Bayesian Gamma-Poisson Conjugate Model__ <br> Author: Tyler J. Brough <br> Last Update: December 6, 2021 <br> <br> --- <br> ``` import numpy as np import pandas as pd from scipy import stats import seaborn as sns...
github_jupyter
# Introduction to MPI ## Overview ### Questions * What is MPI? * Why should I run my simulations in parallel? * How can I execute scripts in parallel? ### Objectives * Describe **MPI**. * Explain how **MPI** can provide faster **performance** on **HPC** systems. * Show how to write a **single program** that can ...
github_jupyter
# Introduction to Jupyter Notebooks This lesson will introduce the Jupyter Notebook interface. We will use the interface to run and write, yes, write, some Python code for text data analysis. By the end of this lesson, learners should be able to: 1. Explain the difference between markdown and code blocks in Jupyter ...
github_jupyter
# Introduction ## Goals By the end of this course, you should be able to - Do basic data analysis using R or Python/Pandas, with a special emphasis on - The practical side of things you might not learn in academic courses - workflows and strategies that work in research What this course is NOT: - A basic course in...
github_jupyter
# Goal * Primer design for clade of interest # Var ``` base_dir = '/ebio/abt3_projects/software/dev/ll_pipelines/llprimer/experiments/HMP_most-wanted/v0.3/' clade = 'Prevotella' domain = 'Bacteria' taxid = 838 ``` # Init ``` library(dplyr) library(tidyr) library(data.table) library(tidytable) library(ggplot2) libr...
github_jupyter
# Phasing haplotypes of gene 1217 in CAMP Version of the `Phasing-LJA.ipynb` notebook adapted to just analyze "haplotypes" of gene 1217 in CAMP. The code for performing read smoothing is derived from that notebook's code; ideally we would consolidate these into a single script to limit code reuse, but for the sake of...
github_jupyter
# Generate example data ``` %matplotlib inline import numpy as np import pandas as pd from statsmodels.tsa.arima_process import ArmaProcess from causalimpact import CausalImpact from typing import Dict import seaborn as sns import matplotlib.pyplot as plt import matplotlib import sys sys.path.append("../") import Caus...
github_jupyter
``` !mkdir folds import cPickle as pickle from skmultilearn.dataset import load_from_arff, load_dataset_dump import copy import datetime import numpy as np from scipy.sparse import lil_matrix from sklearn.model_selection import KFold, StratifiedKFold import pandas as pd import copy from itertools import chain from buil...
github_jupyter
``` import sys import rics # Print relevant versions print(f"{rics.__version__=}") print(f"{sys.version=}") !git log --pretty=oneline --abbrev-commit -1 from rics.utility.logs import basic_config, logging basic_config(level=logging.DEBUG, matplotlib_level=logging.INFO) ``` # In vs between What's faster at various c...
github_jupyter
# Exploring und Plotting 2 **Inhalt:** Selbständige Übung in Gruppen **Nötige Skills:** Time Series **Lernziele:** - Selbständig Daten explorieren und Storyideen testen # Das Beispiel Börsenkurse aller Bluechips-Firmen an der Schweizer Börse. Korpus: https://www.six-group.com/exchanges/shares/explorer/swiss_blue_...
github_jupyter
Original code from https://github.com/eriklindernoren/Keras-GAN/blob/master/dcgan/dcgan.py under the following license: MIT License Copyright (c) 2017 Erik Linder-Norén Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), t...
github_jupyter
# Introduction to cuDF Now that you have achieved a basic understanding of Python, it's time to introduce you to [cuDF](https://github.com/rapidsai/cudf), a RAPIDS library that enables you to create and manipulate GPU-accelerated dataframes. cuDF implements an interface similar to Pandas so that Python data scientists...
github_jupyter
##### Copyright 2018 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
# CH. 7 - TOPIC MODELS ## Activities #### Activity 7.01 ``` # not necessary # added to suppress warnings coming from pyLDAvis import warnings warnings.filterwarnings('ignore') import langdetect # language detection import matplotlib.pyplot # plotting import nltk # natural language processing import numpy # array...
github_jupyter
``` #cell-width control from IPython.core.display import display, HTML display(HTML("<style>.container { width:80% !important; }</style>")) %%javascript IPython.OutputArea.prototype._should_scroll = function(lines) { return false; } #packages import numpy import tensorflow as tf from tensorflow.core.example import ...
github_jupyter
# T test --- If calculated t-value is larger than the tabled value at the desired significance level (alpha = .01), we can reject the null hypothesis and accept the alternative hypothesis, namely, that the difference is likely the result of the experimental treatment and not the result of chance variation. <br/> ---...
github_jupyter
# Getting Started with DaCe DaCe is a Python library that enables optimizing code with ease, from running on a single core to a full supercomputer. With the power of data-centric transformations, it can automatically map code for CPUs, GPUs, and FPGAs. Let's get started with DaCe by importing it: ``` import dace ```...
github_jupyter
# README This notebook is a part of the implementation of ["Adversarial Network Traffic: Towards Evaluating the Robustness of Deep Learning-Based Network Traffic Classification"](https://arxiv.org/abs/2003.01261), including the implementation of flow content classifiers FCC-P, and FCC-HP, and the implementation of Adv...
github_jupyter
# DE Africa Coastlines raster generation <img align="right" src="https://github.com/digitalearthafrica/deafrica-sandbox-notebooks/raw/main/Supplementary_data/DE_Africa_Logo_Stacked_RGB_small.jpg"> This code conducts raster generation for DE Africa Coastlines: * Load stack of all available Landsat 5, 7 and 8 satellite...
github_jupyter
# Flowers Image Classification with TensorFlow on Cloud ML Engine This notebook demonstrates how to do image classification from scratch on a flowers dataset using the Estimator API. ``` import os PROJECT = 'cloud-training-demos' # REPLACE WITH YOUR PROJECT ID BUCKET = 'cloud-training-demos-ml' # REPLACE WITH YOUR BU...
github_jupyter
``` import math import random import gym import numpy as np import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.distributions import Normal from IPython.display import clear_output import matplotlib.pyplot as plt %matplotlib inline ``` <h2>Use CUDA</h2> ``` use_...
github_jupyter
# Least Angle Regression with RobustScaler and Power Transformer This Code template is for the regression analysis using LARS Regressor and the feature transformation technique Power Transformer and Robust Scaler rescaling technique in a pipeline. ### **Required Packages** ``` import warnings import numpy as np imp...
github_jupyter
``` import numpy as np import os import pandas as pd import geopandas as gpd #important import rasterio import matplotlib.pyplot as plt import operator import seaborn as sns import psycopg2 import shapely import laspy #las open from laspy.file import File as read_las #open las from shapely.geometry import Point #con...
github_jupyter
# Torch Core This module contains all the basic functions we need in other modules of the fastai library (split with [`core`](/core.html#core) that contains the ones not requiring pytorch). Its documentation can easily be skipped at a first read, unless you want to know what a given fuction does. ``` from fastai.gen_...
github_jupyter
``` ! pip install psycopg2-binary --user ! pip install --upgrade pip import pandas as pd import psycopg2 import numpy as np from getpass import getpass # connect to database connection = psycopg2.connect( database = "postgres", user = "postgres", password = getpass(), host = "movie-rec-scra...
github_jupyter
# PyTorch Finetune Example TextWiser is designed with extensibility and optimizability in mind. As such, it tries to allow fine-tuning for embeddings that are compatible. The detailed list is available in the README, and we will be using the FastText word embeddings for this example. ``` import os os.chdir('..') ``` ...
github_jupyter
# Hash map A hash map is a data structure that maps keys to values with amortized O(1) insertion, find, and deletion time. The map is unordered. Open3D allows parallel hashing on CPU and GPU with keys and values organized as Tensors, where we take a batch of keys and/or values as input. - Keys: The Open3D hash map su...
github_jupyter
# Xarray-spatial ### User Guide: Remote Sensing tools ----- Xarray-spatial's Remote Sensing tools provide a range of functions pertaining to remote sensing data such as satellite imagery. A range of functions are available to calculate various vegetation and environmental parameters from the range of band data availab...
github_jupyter
``` # import mne import pywt import numpy as np import pandas as pd import antropy as ant from os import listdir # from entropy import * from tqdm import tqdm from scipy.stats import entropy from sklearn.decomposition import PCA from sklearn.utils import shuffle from scipy.stats import entropy from multiprocessing im...
github_jupyter
# Re-creating [Capillary Hysteresis in Neutrally Wettable Fibrous Media: A Pore Network Study of a Fuel Cell Electrode](http://link.springer.com/10.1007/s11242-017-0973-2) # Part A: Percolation ## Introduction In this tutorial, we will use the ```MixedInvasionPercolation``` algorithm to examine capillary hysteresis i...
github_jupyter
# Building an ARIMA Model for a Financial Dataset In this notebook, you will build an ARIMA model for AAPL stock closing prices. The lab objectives are: * Pull data from Google Cloud Storage into a Pandas dataframe * Learn how to prepare raw stock closing data for an ARIMA model * Apply the Dickey-Fuller test * Buil...
github_jupyter
<a href="https://colab.research.google.com/github/Sonochy/UoA_school_mission-12/blob/master/LPE_U_Net.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## [惑星探査育英会 第十二回実習会](https://www.cps-jp.org/~tansaku/wiki/top/?school_mission-12) U-Netを用いたsemantic...
github_jupyter
``` %matplotlib notebook from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt #plt.style.use('ggplot') import ipywidgets as widgets import sys, os, io, string, shutil, math from hublib.ui import Submit from hublib.ui import RunCommand import hublib.use %use boost-1.62.0-mpich2-1.3-gnu-4.7.2 %use lamm...
github_jupyter
# Web scraping: Senate press accrediations In this notebook, we're going to scrape [a table of journalists in the Senate press gallery](https://www.dailypress.senate.gov/?page_id=67). The data are paginated, but what do we see when we inspect the source? Boom: All of the table rows are there on the page when it loads...
github_jupyter
## <p style="text-align: center; font-size: 4em;"> Python tutorial 2 </p> ![python](http://i.imgur.com/bc2xk.png) # 1. random number generators: numpy.random [https://docs.scipy.org/doc/numpy/reference/routines.random.html](https://docs.scipy.org/doc/numpy/reference/routines.random.html) ``` import numpy as np pr...
github_jupyter
# Finding Similar Movies We'll start by loading up the MovieLens dataset. Using Pandas, we can very quickly load the rows of the u.data and u.item files that we care about, and merge them together so we can work with movie names instead of ID's. (In a real production job, you'd stick with ID's and worry about the name...
github_jupyter
# Neural networks simulation (Synchronization Problem) This file is going to study any neural netwrok class which is defined in the `<network_reference.py>` file. ``` import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt import os %%capture from tqdm import tqdm_notebook as tqdm tqdm().pandas() #Th...
github_jupyter
<h1 dir="rtl"><a href="https://koichiyasuoka.github.io/deplacy/">deplacy</a> برای تحلیل نحو</h1> <h2 dir="rtl">با <a href="https://stanfordnlp.github.io/stanza">Stanza</a></h2> ``` !pip install deplacy stanza import stanza stanza.download("fa") nlp=stanza.Pipeline("fa") doc=nlp("به اعتقاد من موسيقي هنر نيست، بلكه متا...
github_jupyter
# End-to-End Example #1 1. [Introduction](#Introduction) 2. [Prerequisites and Preprocessing](#Prequisites-and-Preprocessing) 1. [Permissions and environment variables](#Permissions-and-environment-variables) 2. [Data ingestion](#Data-ingestion) 3. [Data inspection](#Data-inspection) 4. [Data conversion](#Data...
github_jupyter
## Tutorial 4. Network Modularity: Quantitative History Created by Emanuel Flores-Bautista 2018. All code contained in this notebook is licensed under the [Creative Commons License 4.0](https://creativecommons.org/licenses/by/4.0/). This tutorial can be accesed here: https://programminghistorian.org/lessons/explorin...
github_jupyter
## Введение Сегодня познакомимся с инструментами работы с данными. Библиотеки **numpy, pandas, matplotlib**. ``` import numpy as np # для работы с числами, векторами и матрицами import pandas as pd # для работы с датасетом (это умное слово для "набора данных" или "таблицы") import matplotlib.pyplot as plt # для пос...
github_jupyter
![qiskit_header.png](attachment:qiskit_header.png) # Calibrating a qubit ``` import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit from qiskit import IBMQ import qiskit.pulse as pulse import qiskit.pulse.pulse_lib as pulse_lib from qiskit.compiler import assemble from qiskit.qobj.ut...
github_jupyter
# 02 - Reverse Time Migration This notebook is the second in a series of tutorial highlighting various aspects of seismic inversion based on Devito operators. In this second example we aim to highlight the core ideas behind seismic inversion, where we create an image of the subsurface from field recorded data. This tu...
github_jupyter
``` #@title ## Download Kaggle Dataset #@markdown Dataset: Annotated Corpus for Named Entity Recognition <br> #@markdown [https://www.kaggle.com/therohk/million-headlines](https://www.kaggle.com/therohk/million-headlines) #@markdown <br><br> #@markdown News headlines published over a period of seventeen years. #@m...
github_jupyter
``` !pip install catboost import io import os import gc import re import random import pickle from pathlib import Path import pandas as pd import numpy as np from tqdm.auto import tqdm from sklearn.model_selection import StratifiedKFold from sklearn.metrics import accuracy_score from sklearn.metrics import accuracy...
github_jupyter
# NumPy NumPy ist ein Erweiterungsmodul für numerische Berechnungen mit Python. Es beinhaltet grundlegende Datenstrukturen, sprich Matrizen und mehrdimensionale Arrays. Selbst ist NumPy in C umgesetzt worden und bietet mithilfe der Python-Schnittstelle die Möglichkeit Berechnungen schnell durchzuführen. Die Module Sci...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import difflib df = pd.read_json('Fix1.json') df.sort_index(inplace=True) # دانشگاه‌های پذیرفته شده: accUni # دانشگاه انتخاب شده:apUni # Renaming : Cause it is not clear # + Make them a same style! df.rename(columns={"apUni": 'uniSelected', 'acc...
github_jupyter
# ETL Pipeline Preparation Follow the instructions below to help you create your ETL pipeline. ### 1. Import libraries and load datasets. - Import Python libraries - Load `messages.csv` into a dataframe and inspect the first few lines. - Load `categories.csv` into a dataframe and inspect the first few lines. ``` # imp...
github_jupyter
# Map your IBM Cloud data - last modified: July, 2016 - author: [Raj Singh](https://developer.ibm.com/clouddataservices/author/rrsingh/) - original: https://github.com/ibm-cds-labs/open-data/blob/master/samples/cartodb.ipynb - blog post: [Map your IBM Cloud data](https://developer.ibm.com/clouddataservices/) ## Overv...
github_jupyter
# Monitoring Data Drift Over time, models can become less effective at predicting accurately due to changing trends in feature data. This phenomenon is known as *data drift*, and it's important to monitor your machine learning solution to detect it so you can retrain your models if necessary. In this lab, you'll conf...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Testando-Lógica" data-toc-modified-id="Testando-Lógica-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Testando Lógica</a></span></li></ul></div> Ideias: * Criar um diretório específico na pasta do proj...
github_jupyter
# Analysis of Charles Murray's Basic Income Plan Details from http://www.fljs.org/files/publications/Murray.pdf, based on *In Our Hands* (2006). Key elements summarized in [Ghenis (2017)](https://medium.com/@MaxGhenis/the-case-for-a-person-centric-basic-income-plan-55e90010fc9e) include: * Annual amount: \\$10,000, ...
github_jupyter
``` from google.colab import drive drive.mount('/content/drive') ``` # **Introducing the Keras Sequential API** **Learning Objectives** 1. Build a DNN model using the Keras Sequential API 1. Learn how to use feature columns in a Keras model 1. Learn how to train a model with Keras 1. Learn how to save/load, a...
github_jupyter
<style>div.container { width: 100% }</style> <img style="float:left; vertical-align:text-bottom;" height="65" width="172" src="../assets/PyViz_logo_wm_line.png" /> <div style="float:right; vertical-align:text-bottom;"><h2>Tutorial A1. Exploration with Containers</h2></div> In the first two sections of this tutorial w...
github_jupyter
``` import matplotlib import numpy as np import matplotlib.pyplot as plt from pylab import * length=40 for it in range(0,80,20): f,axarr = plt.subplots(4,5,figsize=(50,40)) f.subplots_adjust(hspace=0.1) for ii in range(0,5): for iii in range (0,4): i = it+iii+4*ii maxtime=0 ...
github_jupyter
``` # Copyright 2021 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 copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
github_jupyter
## Stress Determinator ### Bi-directional Long-Short-Term-Memory #### Implemented by Pytorch This is the tutorial notebook for how to use the stress determinator, prepared by **DMaS** and **Douglas Research Center**. **Data used:** All the data sourced from Dr. Wong's mouse neuron experiments in Douglas Research ...
github_jupyter
``` import os import json import numpy as np dataLists = [] dataSource = 'participant' #'pilot' path = './data/interaction_ros_logs' for f in os.listdir(os.path.join(path,dataSource,'session1')): filepath = os.path.join(path,dataSource,'session1',f) if os.path.isfile(filepath): # Read in ...
github_jupyter
# Osher solution to a scalar Riemann problem Implementation of the general solution to the scalar Riemann problem that is valid also for non-convex fluxes. $$ Q(\xi) = \begin{cases} \text{argmin}_{q_l \leq q \leq q_r} [f(q) - \xi q]& \text{if} ~q_l\leq q_r,\\ \text{argmax}_{q_r \leq q \leq q_l} [f(q) - \xi q...
github_jupyter
``` import tensorflow as tf import random import numpy as np import time import sys, getopt from tensorflow.contrib import rnn def stdout(s): sys.stdout.write(str(s)+'\n') nrod = 400 nlabel = 6 batchsize = 200 seq_len = 3 nEpoch = 2 eta = 1e-2 nInput = nrod nHidden = 32 nDense = 32 subnlayer = 1 seqnlayer = 1 bThe...
github_jupyter
``` %matplotlib inline ``` # Comparing anomaly detection algorithms for outlier detection on toy datasets This example shows characteristics of different anomaly detection algorithms on 2D datasets. Datasets contain one or two modes (regions of high density) to illustrate the ability of algorithms to cope with mult...
github_jupyter
___ <a href='https://www.udemy.com/user/joseportilla/'><img src='../Pierian_Data_Logo.png'/></a> ___ <center><em>Content Copyright by Pierian Data</em></center> # Nested Statements and Scope Now that we have gone over writing our own functions, it's important to understand how Python deals with the variable names y...
github_jupyter
# TCSS503 - Week 2 Balanced Trees In this simple interactive tutorial, we will create a **Red-Black Tree**. A Red-Black Tree is an implementation of a Binary Search Tree that grows from bottom to top, maintaining its balance to guarante a $O(\log{n})$ time complexity for Inserts and Searches. ## Red-Black Tree A R...
github_jupyter
# Função Softmax A função softmax é um dos blocos básicos de redes neurais. Ela é usualmente utilizada em classificação multiclasses. Ela transforma valores ("scores", "logits") em probabilidades. Nesse tutorial, iremos: 1. Ver a definição da função softmax, 2. Implementá-la via programação matricial e 3. Explorar ...
github_jupyter
# Lambda Functions (Funções Anônimas) https://realpython.com/python-lambda/ Identity function. Returns its argument: ``` def identity(x): return x ``` In contrast, if you use a Python Lambda Construction, you get the following: ``` lambda x: x ``` In the example above, the expression is composed of: - The ke...
github_jupyter
# UCS Manager Python SDK Examples Used with the UCS Platform Emulator with the IP address `192.168.72.4`. - Update the `ip`, `username`, and `password` constant values below, as necessary. --- ## Constants ``` # UCSM credentials IP = '192.168.72.4' USERNAME = 'admin' PASSWORD = 'admin' SECURE = False # NTP server...
github_jupyter
### Independent Component Analysis &nbsp; Independent Component Analysis is an algorithm to obtain a linear combination of the original data source. So does Principal Component Analysis! Well, ICA attempts to decompose the original data into independent subsets yet PCA attempts to maximize the variance in the new lin...
github_jupyter
# MNIST distributed training and batch transform The SageMaker Python SDK helps you deploy your models for training and hosting in optimized, production-ready containers in SageMaker. The SageMaker Python SDK is easy to use, modular, extensible and compatible with TensorFlow and MXNet. This tutorial focuses on how to ...
github_jupyter
``` from urllib.request import urlopen data_set_url = 'https://static-content.springer.com/esm/art%3A10.1038%2Fncomms5212/MediaObjects/41467_2014_BFncomms5212_MOESM1045_ESM.txt' data = urlopen(data_set_url) my_data = [] for line in data: data_row = line.decode().rstrip() my_data.append([term for term in data_r...
github_jupyter
<a href="https://colab.research.google.com/github/AnilZen/centpy/blob/master/notebooks/Scalar_2d.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Quasilinear scalar equation with CentPy in 2d ### Import packages ``` # Install the centpy package !...
github_jupyter
# Pendulum visualization using ipywidgets v2 adds driving force curve * Created 12-Dec-2018 by Dick Furnstahl (furnstahl.1@osu.edu) * Last revised 19-Jan-2019 by Dick Furnstahl (furnstahl.1@osu.edu). ``` %matplotlib inline import numpy as np from scipy.integrate import ode, odeint import matplotlib.pyplot as plt ``...
github_jupyter
## Kaggle Dogbreeds ``` %reload_ext autoreload %autoreload 2 %matplotlib inline from fastai.imports import * from fastai.conv_learner import * from fastai.model import * from fastai.dataset import * from fastai.sgdr import * from fastai.plots import * PATH = "data/dogbreeds/" TRAIN = "train/"; VALID = "valid/"; TEST ...
github_jupyter
# Learning a cosine with keras ``` import os os.environ['THEANO_FLAGS']='mode=FAST_COMPILE,optimizer=None,device=cpu,floatX=float32' import numpy as np import sklearn.cross_validation as skcv #x = np.linspace(0, 5*np.pi, num=10000, dtype=np.float32) x = np.linspace(0, 4*np.pi, num=10000, dtype=np.float32) y = np.cos(x...
github_jupyter
Adapted from: https://github.com/explosion/spacy-transformers/blob/master/examples/Spacy_Transformers_Demo.ipynb # Spacy PyTorch Transformers Demo [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1lG3ReZc9ESyVPsstjuu5ek73u6vVsi3X) ![alt text](https:...
github_jupyter
``` # ML_in_Finance_ARIMA-HFT # Author: Matthew Dixon # Version: 1.0 (24.7.2019) # License: MIT # Email: matthew.dixon@iit.edu # Notes: tested on Mac OS X with Python 3.6 and Tensorflow 1.3.0 # Citation: Please cite the following reference if this notebook is used for research purposes: # Dixon M.F., I. Halperin and P....
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from tsmoothie.utils_func import sim_seasonal_data from tsmoothie.smoother import * ``` # SINGLE SEASONALITY ``` # generate sinusoidal timeseries np.random.seed(33) data = sim_seasonal_data(n_series=10, timesteps=300, freq=24, measure_...
github_jupyter
# Lab 2: Indexing and Slicing For this lab, we'll get a bit of hands on practice creating data structures, practicing how to apply some common methods, and we'll learn about how to access elements inside the data structures using indexing and slicing. ## Strings Let's create a bit a chunk of text so that we can practi...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from computerrefractored import Computer import re %load_ext autoreload %autoreload 2 noun, verb = 0,0 f=open('input.txt').read() memory = tuple(int(i) for i in f.split(',')) # let's make it immutable as a tuple memsize = 100000 memory = tuple(list(memory)+[0]*mems...
github_jupyter