text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# 19. Knowledge in Learning **19.1** \[dbsig-exercise\]Show, by translating into conjunctive normal form and applying resolution, that the conclusion drawn on page [dbsig-page](#/) concerning Brazilians is sound. **19.2** For each of the following determinations, write down the logical representation and explain why ...
github_jupyter
``` !pip install -r requirements.txt from mindee import Client import json import cv2 from matplotlib import pyplot as plt import numpy as np import math from IPython.lib.pretty import pretty mindee_client = Client( passport_token='<insert api key>', raise_on_error=True ) #get a free api key at platform.mindee....
github_jupyter
# Develop Model In this noteook, we will go through the steps to load the pre-trained InceptionV3 model, pre-process the images to the required format and call the model to find the top predictions. ``` import os import numpy as np import tensorflow as tf from keras.applications.inception_v3 import InceptionV3 from k...
github_jupyter
##### Copyright 2021 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
# Winning the GHZ Game on Real IBM Quantum Computer<a name="top"></a> *Lennart Schulze, Dr. Jan-Rainer Lahmann, October 2020* The GHZ game is a serious game for quantum computing to show the quantum mechanical property of entanglement. Three players are asked for two different properties A and B of an object, an each...
github_jupyter
# Deep Learning & Art: Neural Style Transfer Welcome to the second assignment of this week. In this assignment, you will learn about Neural Style Transfer. This algorithm was created by Gatys et al. (2015) (https://arxiv.org/abs/1508.06576). **In this assignment, you will:** - Implement the neural style transfer alg...
github_jupyter
# Introduction Today we'll dive deep into a dataset all about LEGO. From the dataset we can ask whole bunch of interesting questions about the history of the LEGO company, their product offering, and which LEGO set ultimately rules them all: <ul type="square"> <li>What is the most enormous LEGO set ever created and h...
github_jupyter
# Machine Learning and Statistics for Physicists A significant part of this material is taken from David Kirkby's material for a [UC Irvine](https://uci.edu/) course offered by the [Department of Physics and Astronomy](https://www.physics.uci.edu/). Content is maintained on [github](github.com/dkirkby/MachineLearning...
github_jupyter
``` import numpy as np from nltk.stem import PorterStemmer from nltk.corpus import stopwords from nltk.corpus import wordnet as wn %run scripts/helper.py crowd_train = load_file('./data/train.csv/train.csv', None) # General text related features # 1. Text length of the title crowd_train.columns title_length = crowd_tra...
github_jupyter
pandas 라이브러리 호출 ``` import pandas as pd # pandas 라이브러리를 pd 이름으로 호출 ``` # Series ``` prices = [1000, 1010, 1020] # 주가를 담아놓은 리스트 생성 dates = pd.date_range('2018-12-01', periods=3) # date_range 함수를 이용해 날짜 생성 dates ``` https://pandas.pydata.org/pandas-docs/stable/generated/pandas.date_range.html ``` help(pd...
github_jupyter
<a href="https://colab.research.google.com/github/librairy/EQAKG/blob/main/test/MuHeQA_Evaluation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import pandas as pd pd.set_option('max_colwidth', 400) ``` # VQuAnDa ``` # read csv file results...
github_jupyter
# Leaky Aquifer Test **This example is taken from AQTESOLV examples.** ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt import pandas as pd from ttim import * ``` Set basic parameters: ``` Q = 24464.06 #constant discharge in m^3/d b1 = 6.096 #overlying aquitard thickness in m b2 = 15.24 #aqu...
github_jupyter
2- Se tiene un registro de transacciones bancarias, de la forma (nro de transacción, tipo de transacción, cuenta origen, cuenta destino, fecha, hora, monto). Se pide resolver en Pandas: * Validar que todas las transacciones cuenten con un tipo de transacción. * Validar que para las transacciones del tipo transferenci...
github_jupyter
# Dynamic programming: Value and Policy Iteration In this section, we will apply value and policy iteration to a toy environment that consists of a 3 x 4 grid that's depicted in the following diagram with the following features: - **States**: 11 states represented as two-dimensional coordinates. One field is not acce...
github_jupyter
``` %matplotlib inline import nivapy3 as nivapy import numpy as np import pandas as pd import os import seaborn as sn import matplotlib.pyplot as plt import toc_trends_analysis as resa2_trends import warnings warnings.filterwarnings("ignore", message="Mean of empty slice") plt.style.use('ggplot') # Connect to NIVABASE...
github_jupyter
# Facing the Music ## Binaural Sound Localisation with Machine Learning ``` import numpy as np import sys import IPython.display as ipd import librosa import matplotlib.pyplot as plt from librosa import display import data_generator_lib import data_to_raw_numpy import gccphat import constants import final_models from...
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
# Advanced filtering In this tutorial we are going to see how to use the ``F`` object to do advanced filtering of hosts. Let's start by initiating nornir and looking at the inventory: ``` from nornir import InitNornir from nornir.core.filter import F nr = InitNornir(config_file="advanced_filtering/config.yaml") %cat...
github_jupyter
# Cifar10 Outlier Detection ![demo](./demo.png) In this example we will deploy an image classification model along with an outlier detector trained on the same dataset. For in depth details on creating an outlier detection model for your own dataset see the [alibi-detect project](https://github.com/SeldonIO/alibi-dete...
github_jupyter
# Masakhane - Machine Translation for African Languages (Using JoeyNMT) ## Note before beginning: ### - The idea is that you should be able to make minimal changes to this in order to get SOME result for your own translation corpus. ### - The tl;dr: Go to the **"TODO"** comments which will tell you what to update to...
github_jupyter
<!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="figures/k2_pix_small.png"> *This notebook contains an excerpt instructional material from [gully](https://twitter.com/gully_) and the [K2 Guest Observer Office](https://keplerscience.arc.nasa.gov/); the content is available [on GitHub](https://g...
github_jupyter
## Imports ``` from google.colab import drive drive.mount('/content/drive') path ='drive/MyDrive/Code/Scripts/' path_data ='drive/MyDrive/Data/' import sys, os, random sys.path.append(path) import h5py import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.special import logs...
github_jupyter
# Training a neural network on QM9 This tutorial will explain how to use SchNetPack for training a model on the QM9 dataset and how the trained model can be used for further. First, we import the necessary modules and create a new directory for the data and our model. ``` import os import schnetpack as spk qm9tut =...
github_jupyter
``` %load_ext autoreload %autoreload 2 """Reloads all functions automatically""" %matplotlib notebook from irreversible_stressstrain import StressStrain as strainmodel import test_suite as suite import graph_suite as plot import numpy as np model = strainmodel('ref/HSRS/22').get_experimental_data() slopes = suite.g...
github_jupyter
``` import pandas as pd df=pd.read_csv('ex/data/days-simulated-v2.tsv') #target structure df.head() df=pd.read_html('ex/3.html') import matplotlib.pyplot as plt %matplotlib inline df[0].head() df1=pd.read_csv('ex/1.csv') df2=pd.read_csv('ex/2.csv') df3=pd.read_csv('ex/3.csv') df=pd.concat([df1,df2[1:],df3[1:]]) #no nee...
github_jupyter
# Some Math Background Manipulating numbers, scalars, vectors, and matrices lies at the heart of most machine learning approaches. In this pairs of introductory notebooks, you need some basic algebra and geometry background. You will add to what you know by: * Learning what are and how to represent scalars, vectors...
github_jupyter
# Monte Carlo Stocking Optimization ``` import itertools as it import matplotlib.pyplot as plt import numpy as np import pandas as pd import pyomo.environ as pyo from mciso import model, utils, visualize plt.style.use("seaborn") RNG = np.random.default_rng() sheet_id = "1mPcE2lKxwxgNtohLG5Oj57YzsNV2rL0czuWTUPxHPg8...
github_jupyter
# Python: Data analysis with numpy **Goal**: perform statistical computations and interprete the results! ## Goal The **goal** of this part is to analyze the data of the dataset world_alcohol with numpy. As a reminder, this dataset lists the alcohol consumption by country. We will look at which countries consume the...
github_jupyter
# CIFAR 10 This example is a copy of [Convolutional Neural Network (CNN)](https://www.tensorflow.org/tutorials/images/cnn) exmample of Tensorflow. **It does NOT work with a Complex database** but uses this library Layers to test it's correct behaviour. ## Import stuff ``` import tensorflow as tf import numpy as np i...
github_jupyter
# PR-027 Glove 곽근봉 님의 [Glove 강의](https://www.youtube.com/watch?v=uZ2GtEe-50E&list=PLlMkM4tgfjnJhhd4wn5aj8fVTYJwIpWkS&index=28) 감사드립니다. word embedding이 처음이시라면 word2vector.ipynb 부터 보시는 걸 추천드립니다. Glove를 이용해 간단한 문장을 학습시킵니다. [tensorflow-glove](https://github.com/GradySimon/tensorflow-glove) 코드를 simple하게 옮겨보았습니다. 논문: ht...
github_jupyter
Open initial condition file. Download from olympus if necessary. ``` %matplotlib inline import matplotlib.pyplot as plt import holoviews as hv hv.extension('bokeh', 'matplotlib') url = "http://atmos.washington.edu/~nbren12/data/ic.nc" ![[ -e ic.nc ]] || wget {url} ic = xr.open_dataset("ic.nc") from sam.case import Ini...
github_jupyter
# Lab 01 : MLP -- solution # Understanding the training loop ``` # For Google Colaboratory import sys, os if 'google.colab' in sys.modules: from google.colab import drive drive.mount('/content/gdrive') file_name = 'mlp_solution.ipynb' import subprocess path_to_file = subprocess.check_output('find ...
github_jupyter
# Intro to Random Forests ## About this course ### Teaching approach This course is being taught by Jeremy Howard, and was developed by Jeremy along with Rachel Thomas. Rachel has been dealing with a life-threatening illness so will not be teaching as originally planned this year. Jeremy has worked in a number of d...
github_jupyter
``` import gc import scanit import torch import random import scanpy as sc import pandas as pd import anndata import numpy as np from scipy import sparse from sklearn.metrics import normalized_mutual_info_score, adjusted_rand_score from sklearn.cluster import SpectralClustering, KMeans import matplotlib.pyplot as plt i...
github_jupyter
# Luther - Data Cleaning and Merging Dataframes This is part 2 of the Luther Project. In part 1, I've created 6 different dataframes that will be merged and cleaned in this notebook. The final merged dataframe "merged2.pkl" will be used in the last notebook "03 - Luther - Linear Regression" to develop a final linear r...
github_jupyter
``` import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as mcolors import scipy from matplotlib.colors import LogNorm import pandas as pd import seaborn as sns %matplotlib inline # sys.path.insert(1, "/users/PAS0654/osu8354/ARA_cvmfs/source/AraRoot/analysis/ARA_analysis/...
github_jupyter
# 1. Let's make it more idiomatic Your task is to refactor the following report generation code to more idiomatic. The existing implementation was written by an unknown developer who did not know anything about the idioms of Python. Luckily the unkown developer documented the implementation decently and wrote some tes...
github_jupyter
``` %matplotlib inline %load_ext autoreload %autoreload 2 gesinputs = pd.read_hdf('/data/jls/GaiaDR2/spectro/GES_input.hdf5') from astropy.table import Table ges = Table.read('/data/jls/GaiaDR2/spectro/GES_distances_withPRIOR.hdf5') def input_output(inputs, data, a, title): fltr = data['flag']==0 fltr &= data['...
github_jupyter
# PoLitBert - Polish RoBERT'a model ## Preparation of vocabulary and encoding the data Used corpuses: * Wikipedia, Link: * Oscar * Polish Books Usefull resources * https://github.com/pytorch/fairseq/blob/master/examples/roberta/README.pretraining.md * https://github.com/musixmatchresearch/umberto/issues/2 ``` imp...
github_jupyter
<!--BOOK_INFORMATION--> <img align="left" style="padding-right:10px;" src="fig/cover-small.jpg"> *This notebook contains an excerpt from the [Whirlwind Tour of Python](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jake...
github_jupyter
# Branching using Conditional Statements and Loops in Python ![](https://i.imgur.com/7RfcHV0.png) ### Part 3 of "Data Analysis with Python: Zero to Pandas" 본 자습서는 다음 주제를 다룹니다.: - `if`, `else`, `elif` 을 이용한 분기 - 중첩 조건문과 `if` 표현식 - `while` 반복문 - `for` 반복문 - 중첩 반복문, `break` 과 `continue` 설명 ### How to run t...
github_jupyter
# Booleans ``` # Let's declare some bools spam = True print spam print type(spam) eggs = False print eggs print type(eggs) ``` ### Python truth value testing - Any object can be tested for truth value - Truth value testing is used in flow control or in Boolean operations - All objects are evaluated as True...
github_jupyter
# Autonomous driving - Car detection Welcome to your week 3 programming assignment. You will learn about object detection using the very powerful YOLO model. Many of the ideas in this notebook are described in the two YOLO papers: Redmon et al., 2016 (https://arxiv.org/abs/1506.02640) and Redmon and Farhadi, 2016 (htt...
github_jupyter
``` import os import cPickle as pickle import numpy as np import pandas as pd from sklearn.cross_validation import train_test_split import sys sys.path.append('../') %matplotlib inline import matplotlib as mpl import matplotlib.pylab as plt from src.TTRegression import TTRegression import urllib train_fraction = 0.8 ...
github_jupyter
## PyTorch Implementation of Curiosity-Driven Exploration by Self-Supervised Prediction ### Trained to play Super Mario Bros. with and without game-generated explicit rewards. #### Successfully learns to progress through game with just intrinsic (curiosity) rewards. - Paper: "Curiosity-driven Exploration by Self-superv...
github_jupyter
To open this notebook in Google Colab and start coding, click on the Colab icon below. <table style="border:2px solid orange" align="left"> <td style="border:2px solid orange "> <a target="_blank" href="https://colab.research.google.com/github/neuefische/ds-welcome-package/blob/main/programming/1_Python_Variable...
github_jupyter
# Video Games Sales Analysis In this project I will use the video games sales data for analysis. I will try to gain useful insights from this dataset and improve my skills while doing so. This analysis is part of the Zero to Pandas course offered by Jovian ML and FreecodeCamp. ## Downloading the Dataset The dataset...
github_jupyter
## **Example. Estimating a population total under simple random sampling using transformed normal models** ``` %matplotlib inline import random import statistics as stat import matplotlib.pyplot as plt import numpy as np import pymc as pm import theano.tensor as tt from scipy import stats plt.style.use('seaborn-da...
github_jupyter
<a href="https://colab.research.google.com/github/stephenbeckr/randomized-algorithm-class/blob/master/Demos/demo02_sorts.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Demo 2: sorting Demo to show the effect of randomized perturbations on the sp...
github_jupyter
# AWS Step Functions Data Science SDK - Hello World 1. [Introduction](#Introduction) 1. [Setup](#Setup) 1. [Create steps for your workflow](#Create-steps-for-your-workflow) 1. [Define the workflow instance](#Define-the-workflow-instance) 1. [Review the Amazon States Language code for your workflow](#Review-the-Amazon-S...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import os import tensorflow as tf from tensorflow.keras.preprocessing import image_dataset_from_directory from tensorflow import keras PATH = "/content/drive/MyDrive/Projects/Yoga-82/A_Notebooks/" NUM_CLASSES = 5 IMAGE_RESIZE = 224 BATCH_SIZE = 32 IMG_SIZE = (22...
github_jupyter
``` %load_ext autoreload %autoreload 2 import logging logging.basicConfig(format="%(asctime)s [%(process)d] %(levelname)-8s " "%(name)s,%(lineno)s\t%(message)s") logging.getLogger().setLevel('INFO') %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from tq...
github_jupyter
``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed u...
github_jupyter
### Elevation profiles extracted from SRTM over Mt Baker compared with ICESat-2 ``` import numpy as np import geopandas as gpd import rasterio import matplotlib.pyplot as plt import glob from topolib import gda_lib import topolib import gdal ``` ### Read reference DEM ``` # dem_fn = '/home/jovyan/data/srtm_elevation...
github_jupyter
``` !git clone https://github.com/RiskModellingResearch/DeepLearning_Winter22.git !pip install torchmetrics import numpy as np import pandas as pd import pickle import torch print(torch.__version__) import torch.nn as nn import torch.optim as optim from torch.utils.tensorboard import SummaryWriter from torchmetrics i...
github_jupyter
<hr style="height:3px;border:none;color:#333;background-color:#333;" /> <img style=" float:right; display:inline" src="http://opencloud.utsa.edu/wp-content/themes/utsa-oci/images/logo.png"/> ### **University of Texas at San Antonio** <br/> <br/> <span style="color:#000; font-family: 'Bebas Neue'; font-size: 2.5em;"...
github_jupyter
# Contextual Bandits with Parametric Actions - 실험 모드 이 노트북은 Amazon SageMaker에서 contextual bandits 알고리즘으로 변동하는 행동(action) 개수에 대한 사용 예시를 보여줍니다. 이 노트북은 고정된 수의 행동들을 사용하는 [Contextual Bandits 예제 노트북](https://github.com/awslabs/amazon-sagemaker-examples/blob/master/reinforcement_learning/bandits_statlog_vw_customEnv/bandits_...
github_jupyter
(1) Lihat Petunjuk di bawah ini ``` # Luas ruangan dalam meter persegi hall = 11.25 kit = 18.0 liv = 20.0 bed = 10.75 bath = 9.50 # Buatlah list dengan nama area berdasarkan variabel diatas dan print area # Jawab disini ``` (2) - Buatlah list dengan nama variabel area_2 kemudian sisipkan "Hallway", "Kitchen", "Livin...
github_jupyter
# 类型提示 {mod}`typing` 提供了对类型提示的运行时支持。最基本的支持包括 {data}`Any`, {data}`Union`, {data}`Callable`, {class}`TypeVar`, 和 {class}`Generic`。 示例: ``` def greeting(name: str) -> str: return 'Hello ' + name getattr(greeting, '__annotations__', None) ``` ## 类型别名 把类型赋给别名,就可以定义类型别名。本例中,`Vector` 和 `list[float]` 相同,可互换: ``` Vec...
github_jupyter
# Exploring and undertanding documental databases with topic models Version 1.0 Date: Nov 23, 2017 Authors: * Jerónimo Arenas-García (jeronimo.arenas@uc3m.es) * Jesús Cid-Sueiro (jcid@tsc.uc3m.es) ``` # Common imports %matplotlib inline import matplotlib.pyplot as plt import pylab import numpy as np # im...
github_jupyter
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W2D4_DynamicNetworks/W2D4_Tutorial3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Bonus Tutorial: Extending the Wilson-Cowan Model **Week 2,...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Plot style sns.set() %pylab inline pylab.rcParams['figure.figsize'] = (4, 4) # Avoid inaccurate floating values (for inverse matrices in dot product for instance) # See https://stackoverflow.com/questions/24537791/numpy-matrix-inversion-roun...
github_jupyter
# Reference model - test set: age, temperature ## Table of contents 1. [Linear Regression](#LinearRegression) 2. [MLP (Dense)](#MLP) 3. [AE combined latent](#AE_combined) 4. [AE OTU latent](#AE_latentOTU) ``` import sys sys.path.append('../../Src/') from data import * from transfer_learning import * from test_functio...
github_jupyter
# Project: Univariate Linear Regression * **Business Understanding Phase:** In this Project we want to model how Profit in Bike Sharing Business Increases with the increase in Population in the City. * **Data Understanding Phase:** The Data Consists of a Profit in Dollars of Bike Sharing Business with respect...
github_jupyter
# Credit Experiment This notebook contains the code to reproduce the Credit experiment. The datasets are stored in the _data_ folder in the repo. **Run the following cells in order to reproduce the experiment from the paper.** ``` from boexplain import fmax import pandas as pd import numpy as np from sklearn.tree im...
github_jupyter
# Energy Packet Initialization While it is instructive to think about tracking the propagation history of individual photons when illustrating the basic idea behind Monte Carlo radiative transfer techniques, there are important numerical reasons for using a different discretization scheme. Instead of thinking in the p...
github_jupyter
# Degradation example with clearsky workflow This juypter notebook is intended to illustrate the degradation analysis workflow. In addition, the notebook demonstrates the effects of changes in the workflow. For a consistent experience, we recommend installing the packages and versions documented in `docs/notebook_re...
github_jupyter
# Think Bayes: Chapter 3 This notebook presents example code and exercise solutions for Think Bayes. Copyright 2016 Allen B. Downey MIT License: https://opensource.org/licenses/MIT ``` from __future__ import print_function, division % matplotlib inline import thinkplot from thinkbayes2 import Hist, Pmf, Suite, Cd...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import xarray as xr import cartopy.crs as ccrs import glob import os import scipy.stats from matplotlib import cm import seaborn as sns import dask import matplotlib.colors as mcolors dask.config.set(**{'array.slicing.split_large_chunks': False}...
github_jupyter
## BERT run model script The purpose of this script is to train and test the BERT models. This script is designed to be used in Google Colaboratory in the sense that: - it assumes data will be loaded from both Google Drive and Google Storage Buckets - it assumes the script will be executed on a Colabotory GPU One tr...
github_jupyter
# PODPAC AWS Support ``` from podpac.managers import aws from podpac import settings ``` ## AWS Session The session is used for authentication and setting the region of services ``` # If no credentials are input, then PODPAC will look in the Settings settings['AWS_ACCESS_KEY_ID'] = 'id' settings['AWS_SECRET_ACCESS...
github_jupyter
# Micromagnetic standard problem 4 ## Problem specification The sample is a thin film cuboid with dimensions: - length $l_{x} = 500 \,\text{nm}$, - width $l_{y} = 125 \,\text{nm}$, and - thickness $l_{z} = 3 \,\text{nm}$. The material parameters (similar to permalloy) are: - exchange energy constant $A = 1.3 \time...
github_jupyter
# Bucketing We already saw that using a prepartitioned DataFrame for joins and grouped aggregations can accelerate execution time, but so far the prepartitioning had to be performed every time data is loaded from disk. It would be really nice, if there was some way to store prepartitioned data, such that Spark underst...
github_jupyter
<img src="../../../images/qiskit-heading.gif" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left"> ## _*Quantum Random Number Generation*_ The latest version of this notebook is available on https://github.com/QISKit/qiskit-tutor...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import malaya_speech.train.model.conformer as conformer import malaya_speech.train.model.transducer as transducer import malaya_speech import tensorflow as tf import numpy as np import json from glob import glob subwords = malaya_speech.subword.load('transducer.sub...
github_jupyter
``` %matplotlib inline from os.path import join import pandas as pd import skbio import matplotlib.pyplot as plt from skbio.stats import ordination import seaborn as sns from skbio.stats.distance import permanova sns.palplot(sns.color_palette("YlGnBu", 100)) colors = sns.color_palette("YlGnBu", 100) def filter_dm_and_m...
github_jupyter
# Elfskot PyApi ## Implementation of PyApi The following code is the implementation of the Elfskot PyApi. It is adviced to store the code in a file `elfskotapi.py`, which can then be included in your Python projects. The usage of the PyApi is described in the remainder of this document. ``` # Required packages: # pi...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo...
github_jupyter
``` from keras.preprocessing import sequence from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.layers.embeddings import Embedding from keras.layers import Conv1D, MaxPooling1D, Input, Flatten import numpy as np import sklearn from sklearn.model_selection import trai...
github_jupyter
# Machine learning - Features extraction Runs binary and multi-class classifiers on a given dataset. Dataset are read as Parquet file. The dataset must contain a feature vector named "features" and a classification column. ## Imports ``` from mmtfPyspark.ml import SparkMultiClassClassifier, datasetBalancer ...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt %matplotlib inline import matplotlib as mpl from pandas import * import csv import warnings as warnings from statsmodels.tsa.arima.model import ARIMA from statsmodels.tools.sm_exceptions import ConvergenceWarning # to ignore ConvergenceWarning from tabulate impo...
github_jupyter
# Comparing the Classification Accuracies So, you should now have a set of reference points - either the ones provided (used here) or you could have created your own set using the ClassAccuracy plugin. For this analysis we need to intersect the reference points with each of the classifications which have been produced...
github_jupyter
# Project: Reucurrent Neural Network - A project on weather predictin on time series data ### Step 1: Import libraries ``` import tensorflow as tf import os import pandas as pd import numpy as np from tensorflow.keras import layers, models import matplotlib.pyplot as plt %matplotlib inline ``` ### Step 2: Download d...
github_jupyter
CSCI 183 Lab 2 - Numpy. Nicholas Fong, worked with Salma Abdelmagid # Numpy Reference Guide Sources: http://www.engr.ucsb.edu/~shell/che210d/numpy.pdf https://github.com/hallr/DAT_SF_19/blob/master/code/04_numpy.py ``` import numpy as np import matplotlib.pyplot as plt ``` From here on, np can be used for numpy...
github_jupyter
# Working with Unknown Dataset Sizes This notebook will demonstrate the features built into SmartNoise to handle unknown or private dataset sizes. ### Set up libraries and load exemplar dataset ``` # load libraries import os import opendp.smartnoise.core as sn import numpy as np import math import statistics # esta...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import cython import timeit import math %load_ext cython ``` # Native code compilation We will see how to convert Python code to native compiled code. We will use the example of calculating the pairwise distance between a set of vectors, a $O(n^2)$ operation. F...
github_jupyter
``` import cv2 import numpy as np def preprocess(img, imgsize, jitter, random_placing=False): """ Image preprocess for yolo input Pad the shorter side of the image and resize to (imgsize, imgsize) Args: img (numpy.ndarray): input image whose shape is :math:`(H, W, C)`. Values range f...
github_jupyter
[![AnalyticsDojo](../fig/final-logo.png)](http://rpi.analyticsdojo.com) <center><h1>Intro to Tensorflow - MINST</h1></center> <center><h3><a href = 'http://rpi.analyticsdojo.com'>rpi.analyticsdojo.com</a></h3></center> [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research...
github_jupyter
``` import copy import numpy as np import skimage from skimage.transform import warp from matplotlib import pyplot as plt import time class SkimageAugmentor: def __init__(self, cfg, **kwargs): self.cfg = cfg def aug_image(self, image, **kwargs): # exposure image = skimage.exposure.adj...
github_jupyter
Probabilistic Programming and Bayesian Methods for Hackers ======== Welcome to *Bayesian Methods for Hackers*. The full Github repository is available at [github/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers](https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers)....
github_jupyter
### **Exercise 1**: Remove String Spaces remove the spaces from the string, then return the resultant string. ``` def remove_spaces(x): # your code here return res assert remove_spaces('This is an example') == 'Thisisanexample' assert remove_spaces(' <- lookout -> ') == '<-lookout->' assert remove_spaces(' ...
github_jupyter
# Introduction This is a tutorial for using Forest to analyze Beiwe data. We will also be creating some time series plots using the generated statistic summaries. There are four parts to this tutorial. 1. Check Python version and download Forest. 2. Download sample data. 3. Process data using forest. 4. Creating time...
github_jupyter
<a href="https://colab.research.google.com/github/dribnet/clipit/blob/master/demos/PixelDrawer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> #Pixray PixelArt demo Using pixray to draw pixel art. ![beruit.png](data:image/png;base64,iVBORw0KGgoAAAA...
github_jupyter
# Dictionaries In the previous lessons you used **lists** in your Python code. An object of **class list** is a container of ordered values. The fact that a **list** is *ordered* is a fundamental concept: **lists** work the best when the items stored there can be ordered in a natural and meaningful way. However, tha...
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
## Tuples *Tuples* are sequences like lists, except immutable. ``` my_tuple = (5, 10) # can't do the following! # my_tuple[0] = 7 print(my_tuple[0]) also_a_tuple = (4, 8, 12) print(also_a_tuple[1]) ``` Why would we want such a type? Well, for instance, we might be assigning something like GPS coordinates to cities:...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
# Example: Using the High-Level Estimator In this example, we want to show you how to use the `NaturalPosteriorNetwork` estimator to train and evaluate both single NatPN models and ensembles thereof (NatPE). Although the following is not required, we first want to hide some useless output generated by PyTorch Lightni...
github_jupyter
# About this kernel + efficientnet_b3 + CurricularFace + Mish() activation + Ranger (RAdam + Lookahead) optimizer + margin = 0.7 ## Imports ``` import sys sys.path.append('../input/shopee-competition-utils') sys.path.insert(0,'../input/pytorch-image-models') import numpy as np import pandas as pd import torch ...
github_jupyter
# A study of Object Detection models by [dividiti](http://dividiti.com) ## Table of Contents 1. [Overview](#overview) 1. [Platform](#platform) 1. [Settings](#settings) 1. [Get experimental data](#get_data) 1. [Access experimental data](#access_data) 1. [Plot experimental data](#plot_data) 1. [Plot accuracy](#plot...
github_jupyter