text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
## Stockmarket analysis with `pmdarima` This example follows the post on [Towards Data Science](https://towardsdatascience.com/stock-market-analysis-using-arima-8731ded2447a) (TDS), demonstrating the use of `pmdarima` to simplify time series analysis. ``` import numpy as np import pandas as pd import matplotlib.pyp...
github_jupyter
``` import cv2 as cv import numpy as np import matplotlib import matplotlib.pyplot as plt plt.rc('image', cmap='gray') Org=cv.imread("Samples/1.jpg") Org=cv.resize(Org,(400,round(Org.shape[0]/Org.shape[1]*400))) I=cv.cvtColor(Org,cv.COLOR_RGB2GRAY) I= cv.GaussianBlur(I,(7,7),0) I= cv.Canny(I,50,150,apertureSize = 3) I=...
github_jupyter
# Hello, TensorFlow ## A beginner-level, getting started, basic introduction to TensorFlow TensorFlow is a general-purpose system for graph-based computation. A typical use is machine learning. In this notebook, we'll introduce the basic concepts of TensorFlow using some simple examples. TensorFlow gets its name from...
github_jupyter
# Understanding the Derivative You just saw these three statements. > 1. **Velocity** is the instantaneous rate of change of **position** > 2. **Velocity** is the slope of the tangent line of **position** > 3. **Velocity** is the derivative of **position** But there's another, more formal (and mathematical) definit...
github_jupyter
# Constants ``` IALAB_MEMBER = True IALAB_USER = 'jiossandon' ``` # Imports ``` import os import sys if IALAB_MEMBER: matterport_build_path = f'/home/{IALAB_USER}/datasets/Matterport3DSimulator/build' metadata_script_path = f'/home/{IALAB_USER}/repos/360-visualization/metadata_parser' else: matterport_build_pa...
github_jupyter
``` from src.dataset_wrapper import * from src.networks import * import torch from tqdm import tqdm import numpy as np import matplotlib.pyplot as plt import matplotlib import pickle import matplotlib.patches as patches from matplotlib import animation, rc from IPython.display import HTML with open('scaler.pickle', 'rb...
github_jupyter
### Ch2 Figure1 ``` # You might have a data analyst create a report to see if there's any connection between a customer’s address and the types of shoes they buy. You might find that people in warmer areas are more likely to buy brightly colored shoes. # generate random data shoes_type = ['lightweight trainer', 'cros...
github_jupyter
# Simple example. In this example you'll gain a basic understanding of building custom training loops. - It takes you through the underlying logic of fitting any model to a set of inputs and outputs. - You will be training your model on the linear equation for a straight line, wx + b. - You will implement basic lin...
github_jupyter
# Step 3 - Run the Model Now that we have finished training the model, we can use it to drive the car. Start the AirSim exectuable in a different window, and change the MODEL_FILENAME parameter to point to your downloaded weights. We have included a sample model in case you need it (please note that this is not a perf...
github_jupyter
``` %matplotlib inline import gym from gym.wrappers import Monitor import itertools import numpy as np import os import random import sys import tensorflow as tf if "../" not in sys.path: sys.path.append("../") from lib import plotting from collections import deque, namedtuple env = gym.envs.make("Breakout-v0") # ...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Goal" data-toc-modified-id="Goal-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Goal</a></span></li><li><span><a href="#Var" data-toc-modified-id="Var-2"><span class="toc-item-num">2&nbsp;&nbsp;</span>Va...
github_jupyter
``` #python3 t2_split_gs_score.py --cfv 2 --fromf ts2_16x260_inv #splits cancerous data among gleason score subfolders in trainf and validf folders import os, gc, subprocess, time, sys, shutil, argparse import scipy import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_c...
github_jupyter
# Pandas grouping and debiasing Here we show how to average over independent groups of samples and discuss the biases that zero padding can introduce. This notebook uses a generator for long-range correlated noise which can be obtained via: `pip install colorednoise` or [at github](//github.com/felixpatzelt/coloredno...
github_jupyter
# torchlego **This is an early preview** High quality Neural Networks built with reausable blocks in PyTorch ![alt](https://raw.githubusercontent.com/FrancescoSaverioZuppichini/torchlego/develop/doc/images/lego.jpg) *Photo by Ryan Quintal on Unsplash* ## Motivation This library aims to create new components to m...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/regression-car-price-model-explaination-and-featurization/auto-ml-regressi...
github_jupyter
# Customizing visual appearance HoloViews elements like the `Scatter` points illustrated in the [Introduction](1-Introduction.ipynb) contain two types of information: - **Your data**, in as close to its original form as possible, so that it can be analyzed and accessed as you see fit. - **Metadata specifying what y...
github_jupyter
Markdown === **Juan David Velásquez Henao** jdvelasq@unal.edu.co Universidad Nacional de Colombia, Sede Medellín Facultad de Minas Medellín, Colombia --- Haga click [aquí](https://github.com/jdvelasq/workshop-asocio-2018/tree/master/) para acceder al repositorio online. Haga click [aquí](http://nbviewer.ju...
github_jupyter
## Supervised Learning (Regression) > **Supervised learning** is a type of Machine Learning invlolving learning a function that maps inputs to outputs based on provided input-output pairs. Learning == Model Training. <img src = "https://www.researchgate.net/publication/324426321/figure/fig4/AS:614073280507906@152341...
github_jupyter
# Bike Sharing Prediction Using Neural Network I built a neural network and use it to predict daily bike rental ridership. ``` %matplotlib inline %load_ext autoreload %autoreload 2 %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt ``` ## Load and p...
github_jupyter
# IHA1 - Assignment Welcome to the first individual home assignment! This assignment consists of two parts: * Python and NumPy exercises * Build a deep neural network for forward propagation The focus of this assignment is for you to gain practical knowledge with implementing forward propagation of deep neural...
github_jupyter
<a href="https://colab.research.google.com/github/vanviethieuanh/CS114.L21/blob/main/News%20Scraping/19522054/news/web_scraping.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **WEB SCRAPING** **1. Link các trang báo đã lấy dữ liệu:** + Trang chính...
github_jupyter
# Download Permafrost Data The [Global Terrestrial Network for Permafrost - Database](http://www.gtnpdatabase.org/) contains a repository on data from permafrost sites. Data for both * Thaw Depths (aka Active Layer Thickness) * Temperatures are available. Unfortunately, the site focuses on making the data available...
github_jupyter
# Combined hazard damage relationship This notebook explores the relationship between reported damage and a combination of wind and rainfall as hazard parameters. ``` %matplotlib notebook import os from os.path import join as pjoin import numpy as np import pandas as pd import geopandas as gpd import matplotlib.py...
github_jupyter
# TensorFlow Dataset API **Learning Objectives** 1. Learn how to use tf.data to read data from memory 1. Learn how to use tf.data in a training loop 1. Learn how to use tf.data to read data from disk 1. Learn how to write production input pipelines with feature engineering (batching, shuffling, etc.) In this noteboo...
github_jupyter
# Basic Example of Using Ops - Gaussian Filter #### In this tutorial, we are going to show the basics of how to use an Imagej Ops. First Of all, Let's get ImageJ ready. ``` #@ImageJ ij // Behind a firewall? Configure your proxy settings here. //System.setProperty("http.proxyHost","myproxy.domain") //System.setProper...
github_jupyter
## Using a group convolutional neural network to learn the ground-state of a symmetric spin model The goal of this tutorial is to learn about group convolutional neural networks (G-CNNs), a useful tool for simulating lattices with high symmetry. The G-CNN is a generalization to the convolutional neural network (CNN) t...
github_jupyter
# Stellargraph Ensembles for node attribute inference This notebook demonstrates the use of `stellargraph`'s `Ensemble` class for node attribute inference using the Cora and Pubmed-Diabetes citation datasets. The `Ensemble` class brings ensemble learning to `stellargraph`'s graph neural network models, e.g., `GraphSA...
github_jupyter
``` Students = { 'lloyd' : { "name": "Lloyd", "homework": [90.0,97.0,75.0,92.0], "quizzes": [88.0,40.0,94.0], "tests": [75.0,90.0] }, 'alice' : { "name": "Alice", "homework": [100.0, 92.0, 98.0, 100.0], ...
github_jupyter
# Clean Slate: Estimating offenses eligible for expungement under varying conditions > Prepared by [Laura Feeney](https://github.com/laurafeeney) for Code for Boston's [Clean Slate project](https://github.com/codeforboston/clean-slate). ## Purpose This notebook cleans and processes data from the Northwestern, Suffolk,...
github_jupyter
# 1D Thermal Boundary Conduction: Boundary Conditions, Plans, Cylindrical and Spherical Conduction, Thermal Resistance Local heat flux is measured by the phenomenological <b>Fourier's Law</b>: $$ \vec{q}''=-k\vec{\nabla}T $$ where $k$ is the local thermal conduction, W/(m.K), and the gradient of temperature $\vec{\nab...
github_jupyter
``` pip install ypstruct import numpy as np import matplotlib.pyplot as plt from ypstruct import structure #Cost Function def sphere(x): return np.sum(x**2) #Problem definition problem=structure() problem.costfunc=sphere problem.nvar = 5 problem.varmin = -10 problem.varmax = 10 # GA parameters params=structure...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torchvision import torchvision.transforms as transforms from torch.utils.data import Dataset, DataLoader f...
github_jupyter
# Optimizer Mangement > Handling PyTorch Cuda ``` # default_exp ftorch.optimizer ``` This handler is created to handle the multiple optimizer situations ``` # export import torch class Opts(object): def __init__(self, *args, **kwargs): """ opts = Opts(opt1 = opt1, opt2 = opt2) opts.opt2....
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
``` import pandas as pd import numpy as np rand_st = 101 tst_sz=0.4 ``` ## Using a linear model (Logistic Regressor) ``` df_tanh=pd.read_csv('tanh_data.csv',usecols=['dropout', 'learning.rate', 'L1.regularization', 'training.steps', 'accuracy', 'execution.time']) df_tanh.head() def pred_quality(x): if x<0....
github_jupyter
``` import keras from keras.models import Sequential, Model, load_model from keras.layers import Dense, Dropout, Activation, Flatten, Input, Lambda from keras.layers import Conv2D, MaxPooling2D, Conv1D, MaxPooling1D, LSTM, ConvLSTM2D, GRU, BatchNormalization, LocallyConnected2D, Permute from keras.layers import Concat...
github_jupyter
``` """ We use following lines because we are running on Google Colab If you are running notebook on a local computer, you don't need these """ from google.colab import drive drive.mount('/content/gdrive') import os os.chdir('/content/gdrive/My Drive/finch/tensorflow1/knowledge_graph_completion/wn18/main') import tenso...
github_jupyter
![data-x](https://raw.githubusercontent.com/afo/data-x-plaksha/master/imgsource/dx_logo.png) # __Titanic Survivor Analysis__ #### Author: Several public Kaggle Kernels #### Edits: Alexander Fred Ojala, Kevin Li, Elias Castro Hernandez, and Zhi Li **Sources:** * **Training + explanations**: https://www.kaggle.com/c...
github_jupyter
### Libraries ``` import os import numpy as np import pandas as pd import time ## models from lightgbm import LGBMClassifier # save model from sklearn.externals import joblib # model testing from sklearn.metrics import roc_curve, auc, precision_recall_curve, average_precision_score, confusion_matrix from sklearn.metr...
github_jupyter
# Similarities among reference plasmids in test samples Here, we examine the similarities of the reference plasmids (occurring in the test samples) with each other, in order to check whether we try to predict the same plasmids or very similar ones in different samples over and over again. This could bias the evaluati...
github_jupyter
# BrainRender Tutorial In this tutorial you will be shown the main functionalities of BrainRender, but if you want to dive deeper into the various options available you can check out the other examples! ``` # We begin by adding the current path to sys.path to make sure that the imports work correctly import sys sys.p...
github_jupyter
# RadarCOVID-Report ## Data Extraction ``` import datetime import json import logging import os import shutil import tempfile import textwrap import uuid import matplotlib.ticker import numpy as np import pandas as pd import seaborn as sns %matplotlib inline current_working_directory = os.environ.get("PWD") if curr...
github_jupyter
Welcome to the second project of the Machine Learning Engineer Nanodegree! In this notebook, some template code has already been provided for you, and it will be your job to implement the additional functionality necessary to successfully complete this project. Sections that begin with **'Implementation'** in the heade...
github_jupyter
``` import logging import bz2 import sys import os import numpy as np import qcfractal.interface as ptl import tqdm import sys from qcsubmit import workflow_components from qcsubmit.factories import OptimizationDatasetFactory from openforcefield.topology import Molecule # Need to turn off undefined stereochemistry warn...
github_jupyter
<a href="https://colab.research.google.com/github/joanby/python-ml-course/blob/master/notebooks/T9%20-%202%20-%20K%20Nearest%20Neighbors%20Implementation-Colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Clonamos el repositorio para obtener lo...
github_jupyter
## Another introduction to Bayesian data analysis with PyStan ### Marianne Corvellec *Institute for Globally Distributed Open Research and Education (IGDORE)* <br> <br> <center> Seminar organized by Alberto Antonietti <br> DEIB <br> <b>Politecnico di Milano</b> <br><br> (Milan, Italy) ...
github_jupyter
``` import itertools import os from glob import glob import imageio import numpy as np import tensorflow as tf from skimage.io import imsave from tqdm.notebook import tqdm from adain.image_utils import imshow, prepare_visualization_image, read_image content_images = glob('assets/images/content/*') style_images = glob...
github_jupyter
# Discrete and Continuous Random Variables by Maxwell Margenot Revisions by Delaney Mackenzie Part of the Quantopian Lecture Series: * www.quantopian.com/lectures * github.com/quantopian/research_public Notebook released under the Creative Commons Attribution 4.0 License. --- A random variable is variable that ta...
github_jupyter
# Simulating readout noise on the Rigetti Quantum Virtual Machine © Copyright 2018, Rigetti Computing. $$ \newcommand{ket}[1]{\left|{#1}\right\rangle} \newcommand{bra}[1]{\left\langle {#1}\right|} \newcommand{tr}[1]{\mathrm{Tr}\,\left[ {#1}\right]} \newcommand{expect}[1]{\left\langle {#1} \right \rangle} $$ ## Theore...
github_jupyter
# Use pearson correlation coefficient (for linear regression) as a loss function A wild try: when we try to predict a value where random noise is involved, it might be a good idea to use the regression coefficient for a linear regression between our prediction and the real value as a loss function and metric. In the i...
github_jupyter
# Unit 1 --- 1. [Introducing Notebooks and Markdown](#section1) 2. [Getting help](#section2) 3. [NumPy](#section3) <a id='section1'></a> ## 1. Introducing Notebooks and Markdown IPython - Interactive python. This notebook. If you want to read more, [look here](https://jupyter.readthedocs.io/en/latest/projects/arch...
github_jupyter
``` import matplotlib %matplotlib inline import matplotlib.pyplot as plt, numpy as np from frbpoppy import * #from Convenience import * from PreFRBLE.convenience import * from PreFRBLE.likelihood import * ``` ### FRB host redshift distribution Here we make use of frbpoppy (Gardenier et al. 2020, https://github.com/dav...
github_jupyter
# Ocean station Papa This notebook runs [GOTM](https://gotm.net/) with initial conditions and surface forcing at the [ocean station Papa](https://www.pmel.noaa.gov/ocs/Papa). See Fig. 4 of [Li et al., 2019](https://doi.org/10.1029/2019MS001810). Run the case with four turbulence closure schemes: - GLS-C01A: The gene...
github_jupyter
# Bayesian Analysis Using PyMC3 Statistical inference is a process of learning from incomplete or imperfect (error-contaminated) data. Can account for this "imperfection" using either a sampling model or a measurement error model. ### Statistical hypothesis testing The *de facto* standard for statistical inference i...
github_jupyter
<img style="float:left;margin-right:1em;width:5em;" src="img/flavio.svg"> # flavio: a Python package for flavour phenomenology & more <div style="clear:left;"></div> A tutorial (by David M. Straub) - `flavio` docs: https://flav-io.github.io - `flavio` source: https://github.com/flav-io/flavio - This tutorial: htt...
github_jupyter
``` import pickle import importlib from library import data_preprocess as dp importlib.reload(dp) import random from time import time import numpy as np import keras from keras.preprocessing.text import Tokenizer from keras.utils import to_categorical from keras.preprocessing.sequence import pad_sequences from keras....
github_jupyter
<a href="https://colab.research.google.com/github/souravgopal25/Data-Structure-Algorithm-Nanodegree/blob/master/BST.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #BINARY SEARCH TREE ``` # this code makes the tree that we'll traverse class Node(o...
github_jupyter
# Apply labels with zero-shot classification _This notebook is part of a tutorial series on [txtai](https://github.com/neuml/txtai), an AI-powered semantic search platform._ This notebook shows how zero-shot classification can be used to perform text classification, labeling and topic modeling. txtai provides a light...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" import os import re, string, unicodedata import nltk import contractions import inflect import lime from lime import lime_text from lim...
github_jupyter
``` %matplotlib inline from pymongo import MongoClient import math import datetime import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns sns.set(color_codes=True) def divtd(td1, td2): us1 = td1.microseconds + 1000000 * (td1.seconds + 86400 * td1.days) us2 = td2.microsecon...
github_jupyter
``` from glob import glob import os path_to_train = '../data/train' glob_train_imgs = os.path.join(path_to_train, '*_sat.jpg') glob_train_masks = os.path.join(path_to_train, '*_msk.png') train_img_paths = glob(glob_train_imgs) train_mask_paths = glob(glob_train_masks) print(train_img_paths[:10]) print(train_mask_path...
github_jupyter
**Importing** ``` import pickle import string import nltk from nltk.corpus import stopwords nltk.download('punkt') nltk.download('stopwords') import numpy as np from keras.utils.np_utils import to_categorical import tensorflow_hub as hub import tensorflow as tf from tensorflow.keras.layers import Dense, Input from t...
github_jupyter
``` import torch from torch.autograd import grad import torch.nn as nn from numpy import genfromtxt import torch.optim as optim import matplotlib.pyplot as plt import torch.nn.functional as F sidr_data = genfromtxt('covid_100_pts.csv', delimiter=',') #in the form of [t,S,I,D,R] torch.manual_seed(1234) %%time PATH = ...
github_jupyter
# NewEgg.Com WebScraping Program For Laptops - Beta ### - April 2020 --- ``` # Import dependencies. import os import glob import time import datetime import re from re import search import pandas as pd from splinter import Browser import requests from bs4 import BeautifulSoup as soup import random from playsound im...
github_jupyter
``` #Python Hello World and Statements print ("Hello World") print ("My name is Maulana") ''''' - "Hello World" and "My name is Maulana" named statement - The print() function prints the specified message to the screen, or other standard output device. The message can be a string, or any other object ''''' #Pytho...
github_jupyter
# Open Exploration for 400 Scenarios and 75 Policies ## 1. Introduction The notebook gives a better indication of the policy space rather than just under the base case. Continuing our analysis using only the worst scenarios found in [1-Open-Exploration-Base-Case.ipynb](1-Open-Exploration-Base-Case.ipynb) requires tha...
github_jupyter
``` pip install transformers pip install seqeval import json import pickle import time import datetime import random import os import csv import numpy as np import pandas as pd from tqdm.notebook import tqdm import torch from torch.utils.data import TensorDataset, random_split from torch.utils.data import DataLoader, ...
github_jupyter
``` try: from openmdao.utils.notebook_utils import notebook_mode except ImportError: !python -m pip install openmdao[notebooks] ``` # Instance-Based Call Tracing The `openmdao trace` command can be used to print a trace of each instance method call. For example: ``` bash openmdao trace <your_python_scrip...
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
# Blood donations prediction ### https://www.drivendata.org/competitions/2/warm-up-predict-blood-donations/ #### Predict if the donator will donate in March 2007 ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns training_data = pd.read_csv('../data/BloodDonation_Train.c...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Automated Machine Learning _**Classification with Local Compute**_ ## Contents 1. [Introduction](#Introduction) 1. [Setup](#Setup) 1. [Data](#Data) 1. [Train](#Train) ## Introduction In this example we will explore AutoML's...
github_jupyter
# HW 04 Solutions 1. (a) output is 0-5 V (b) best DAS input range would be 0-10 V, there will be clipping otherwise. (c) Pressure transducer has 3 sources of elemental uncertainties: linearity, repeatability, and hysterisis. We will use the RSS of the 3 elemental uncertainties to find the uncertainty in the pressu...
github_jupyter
# Min-Max, a perfect Tic Tac Toe player In this Notebook, we will use the Min-Max algorithm to create a computer player which will be able to play Tic Tac Toe perfectly. That is, the player will always play the best possible move in a given situation. This player will give us a good benchmark to compare the other play...
github_jupyter
# Getting Started with `deeplenstronomy` The purpose of `deeplenstronomy` is to provide the functionality for users to generate entire datasets using a single input file. The use of this framework separates the programmer from the astronomer when creating datasets, and will hopefully enable the creation of easily-repr...
github_jupyter
# Features of BIDMat and Scala BIDMat is a multi-platform matrix library similar to R, Matlab, Julia or Numpy/Scipy. It takes full advantage of the very powerful Scala Language. Its intended primarily for machine learning, but is has a broad set of operations and datatypes and should be suitable for many other applica...
github_jupyter
<center> <font size=5> <h1>Define working environment</h1> </font> </center> The following cells are used to: - Import needed libraries - Set the environment variables for Python, Anaconda, GRASS GIS and R statistical computing - Define the ["GRASSDATA" folder](https://grass.osgeo.org/grass73/manuals/helptext.html),...
github_jupyter
``` %load_ext autoreload %autoreload 2 #tensorboard doesn't work with keras it seems, needs tf.keras from preprocess import * from tensorflow import keras from tensorflow.keras.models import Sequential from tensorflow.keras.layers import (Convolution1D, GlobalAveragePooling1D, GlobalMaxPool1D, Dense, Dropout, ...
github_jupyter
<img src="../logos/Icos_cp_Logo_RGB.svg" width="400" align="left"/> <a id='intro'></a> # Tools for applying ccg to ICOS data This notebook includes functions in Python for applying the ccg filters to ICOS data. The notebook is divided in the following parts: - [Import Python modules](#import_modules) - [Time func...
github_jupyter
# T81-558: Applications of Deep Neural Networks **Module 8: Kaggle Data Sets.** * Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), School of Engineering and Applied Science, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx) * For more information visit the [c...
github_jupyter
# Machina Quickstart notebook - This notebook example is for beginners who use laptop. - In Machina's architecture, sampling trajectory and training policy is detached. - In this example you can try classic control tasks of [gym](https://gym.openai.com/envs/#classic_control). - On the task of 'Acrobot-v1', an agent...
github_jupyter
``` import pandas as pd import numpy as np import torch import os from PIL import Image from io import BytesIO import random from zipfile import ZipFile from skimage import io, transform import numpy as np import matplotlib.pyplot as plt from torch.utils.data import Dataset, DataLoader from torchvision import transfor...
github_jupyter
``` import pandas as pd import sys sys.path.append("../../DNN-RE/src") dataset_name = 'MB-Clin-DR' target_col_name = 'DR' RAW_DATA_PATH = 'raw_data/MB-Clin-DR.csv' ``` # METABRIC Data Set - **Input:** 350 clinical variables - **Output:** Classification, DR 1 or NDR 0 ## Preprocess Data ``` raw_data = pd.read_csv(RA...
github_jupyter
# DREAMER Arousal EMI-LSTM 64_16 Adapted from Microsoft's notebooks, available at https://github.com/microsoft/EdgeML authored by Dennis et al. ## Imports ``` import pandas as pd import numpy as np from tabulate import tabulate import os import datetime as datetime import pickle as pkl ``` ## DataFrames from CSVs ...
github_jupyter
# Playing with P-values ## Recall some definitions * $H_0$ : null hypothesis: The hypotheis that the effect we are testing for is null * $H_A$ : alternative hypothesis : Not $H_0$, so there is some signal * $T$ : The random variable that takes value "significant" or "not significant" * $T_S$ : Value of T when test...
github_jupyter
<a href="https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/documentation/transforms/python/elementwise/regex-py.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a> <table align="left"><td><a target="_blank" href="https:...
github_jupyter
<a href="https://colab.research.google.com/github/EvgSkv/logica/blob/main/examples/Logica_example_News_connections.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Logica example: News connections Here we find a sequence in the news that connect...
github_jupyter
### Section 0: Loading packages and testing earth engine connection ``` %load_ext autoreload %autoreload 2 import ee import earthlib as eli import folium # authenticate earth engine api access (not required on every run) ee.Authenticate() # initialize earth engine api access (required on every run) ee.Initialize() # t...
github_jupyter
``` import numpy as np import tensorflow as tf import collections def build_dataset(words, n_words): count = [['GO', 0], ['PAD', 1], ['EOS', 2], ['UNK', 3]] count.extend(collections.Counter(words).most_common(n_words - 1)) dictionary = dict() for word, _ in count: dictionary[word] = len(dictiona...
github_jupyter
``` from prettytable import PrettyTable import json def load_simple_json(filename): with open(filename, 'r') as f: return json.load(f) words=load_simple_json('de/occupation_all.json')#{masculine:[[],[feminine]]} words_revert={words[i][1]:i for i in words}#feminine:masculine neutral=load_simple_json('d...
github_jupyter
# Custom TF-Hub Word Embedding with text2hub **Learning Objectives:** 1. Learn how to deploy AI Hub Kubeflow pipeline 1. Learn how to configure the run parameters for text2hub 1. Learn how to inspect text2hub generated artifacts and word embeddings in TensorBoard 1. Learn how to run TF 1.x generated hub module...
github_jupyter
This notebook gives some examples of how to use the `emf.fields` template file. For larger modeling efforts, using a template file makes it easy to store data in a readable format and quickly get results. Template files can be generated with the `emf.fields.drop_template` function. ``` #import fields import emf.fields...
github_jupyter
# Keras Customization: Loss and Activation Functions Your functions must be defined with TensorFlow graph commands. The derivative will be taken automatically. (assuming all components of your function are differentiable) # TensorFlow for Calculation ``` import tensorflow as tf tf.multiply(tf.constant(2),tf.consta...
github_jupyter
``` import numpy as np import pandas as pd from functools import reduce _MULTIINDEX_ = ["NOMBREDD", "NOMBREPV", "NOMBREDI", "CONGLOMERADO", "NSELUA", "UA"] _UACROP_ = ["NOMBREDD", "NOMBREPV", "NOMBREDI", "CONGLOMERADO", "NSELUA", "UA", "crop"] _CROPNAME_ = "PAPA BLANCA" _PATH_ = "https://public.minsky.cc/maria/market_c...
github_jupyter
##### Copyright &copy; 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 ...
github_jupyter
# Xarray-simlab: customize models Xarray-simlab is a modular framework. The motivation behind this framework is to enable an interactive user experience for *both* model exploration (inspection, run) *and* model customization. We'll see here how we can customize xarray-simlab models by adding, dropping or replacing ...
github_jupyter
``` import random import nltk import spacy import re nltk.download("punkt") ``` ### Using Markov chains - calculate the probability of transitioning from one word to another based on unique words in a corpus (text speeches Trump in our case) - once all the probabilities are fed, we can feed it a word from the corpus u...
github_jupyter
**Warning** Work in progress notebook - only for testing purposes only of sunpy and nustar_pysolar ``` from astropy.io import fits import astropy.units as u import matplotlib import matplotlib.pyplot as plt import matplotlib.colors as colors from matplotlib.colors import LogNorm %matplotlib inline # %matplotlib noteb...
github_jupyter
``` import numpy as np import sys,os from scipy import interpolate import matplotlib.pyplot as plt %matplotlib inline plt.style.use('dark_background') from matplotlib.ticker import FormatStrFormatter sys.path.append("..") import pyrads from scipy.integrate import trapz,simps,cumtrapz S = 1361.5 albedo = 0.30 ISR = (...
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
# Wasserstein GAN and Loss Sensitive GAN with CIFAR Data **Prerequisites: ** Please run the notebook _CIFAR-10_DataLoader.ipynb_ prior to this notebook. Be patient, it'll take 10-15 minutes to run! ## Introduction Generative models have gained a lot of attention in deep learning community which has traditionally leve...
github_jupyter