text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
### Resultado com Active Learning ``` # Bibliotecas com métodos, formulas, rotinas para agilizar desenvolvimento import pandas as pd # Configurar o dataframe para exibir 131 colunas de um dataset pd.set_option("max.columns", 131) # Abrir o arquivo df2 = pd.read_csv("active_labels.csv", index_col=0) # Pegar somente a l...
github_jupyter
# Angular extent of the terminator, $\tau$ In this notebook, we validate our expression for the angular extent of the terminator, $\tau$. This is how far the day/night terminator extends past $\frac{\pi}{2}$ past the sub-stellar point in the case that the star has a nonzero angular size as seen from the planet. ``` %...
github_jupyter
# Azavea Climate API Azavea Climate API provides different models and scenarios for universally-recognized temperature and precipitation indicators. Azavea provides access to research and application development through free and open API. Azavea Climate API supports: **Datasets:** [NASA NEX-GDDP](https://cds.nccs.n...
github_jupyter
# Ch `04`: Concept `04` ## Softmax classification Import the usual libraries: ``` %matplotlib inline import numpy as np import tensorflow as tf import matplotlib.pyplot as plt ``` Generated some initial 2D data: ``` learning_rate = 0.01 training_epochs = 1000 num_labels = 3 batch_size = 100 x1_label0 = np.random....
github_jupyter
``` import pymc3 as pm import matplotlib.pyplot as plt import pandas as pd import numpy as np import missingno as msno from sklearn.preprocessing import LabelEncoder import theano.tensor as tt from utils import ECDF %load_ext autoreload %autoreload 2 %matplotlib inline %config InlineBackend.figure_format = 'retina' ``...
github_jupyter
``` import numpy as np ``` $$ \newcommand\bs[1]{\boldsymbol{#1}} $$ # Introduction This first chapter is quite light and concerns the basic elements used in linear algebra and their definitions. It also introduces important functions in Python/Numpy that we will use all along this series. It will explain how to crea...
github_jupyter
# Py4E Ch 2 ## From Section 2.2 Variables ## Variables We've already played with variables in Bash and now we'll look at them in Python. Other than the syntax, there's not a lot different between Bash and Python variables. ``` message = 'And now for something completely different' n = 17 pi = 3.1415926535897931 pri...
github_jupyter
``` # Do not make any changes in this cell # Simply execute it and move on import pandas as pd import numpy as np import matplotlib.pyplot as plt import json ans = [0]*8 # The exercise uses Boston housing dataset which is an inbuilt dataset of scikit learn. # Run the cell below to import and get the informatio...
github_jupyter
# Plot Actions Plots can be configured to run code or other cells when the user clicks on or types into them. ``` from beakerx import * from random import randint abc = 0 # test variable p = Plot(showLegend = True, useToolTip= False) def on_click1(info): info.graphics.display_name = "new name" def on_click2...
github_jupyter
``` # Load the Drive helper and mount from google.colab import drive drive.mount('/content/drive') ``` # Agenda * Linear kernel SVM on simple dataset * Polynomial kernel SVM on simple dataset * RBF kernel SVM on simple dataset * Tuning SVM # Linear kernel SVM **Using SVC (Support Vector Classifier) on skl...
github_jupyter
``` import torch import torch.nn.functional as F from hessian import hessian from hessian_eigenthings.power_iter import Operator, deflated_power_iteration from hessian_eigenthings.lanczos import lanczos from lanczos_generalized import lanczos_generalized from GAN_hvp_operator import GANHVPOperator, compute_hessian_eige...
github_jupyter
# Managed Training with Amazon SageMaker and 🤗 Transformers ### Fine-tune a Multi-Class Classification with `Trainer` and `emotion` dataset and push it to the [Hugging Face Hub](https://huggingface.co/models) ## Usefull links & resources * [SageMaker Documentation](hf.co/docs/sagemaker) * [SageMaker exmaples](http...
github_jupyter
<h1><font size=12> Weather Derivatites </h1> <h1> Vglm Model - Parameters Estimation <br></h1> Developed by [Jesus Solano](mailto:ja.solano588@uniandes.edu.co) <br> 5 October 2018 ``` # Load fulldataset allData <- read.csv(file='../../datasets/fullDataset/completeDailyDataset_2005-01-01_2015-12-31.csv', header=TR...
github_jupyter
**Chapter 11 – Deep Learning** _This notebook contains all the sample code and solutions to the exercices in chapter 11._ # Setup First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures: ``...
github_jupyter
**Chapter 10 – Introduction to Artificial Neural Networks with Keras** _This notebook contains all the sample code and solutions to the exercises in chapter 10._ <table align="left"> <td> <a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/10_neural_nets_with_keras.i...
github_jupyter
``` import os import platform import datetime import numpy as np import pandas as pd import networkx as nx import matplotlib.pyplot as plt from typing import Tuple import seaborn as sns from collections import namedtuple, defaultdict import utils.utilFuncs as utils import utils.info as RailLineInfo from scipy.interpola...
github_jupyter
#DATASCI W261: Machine Learning at Scale ##Version 1: One MapReduce Stage (join data at the first reducer) # Data Generation Data Information: + Sizes: 1000 points + True model: y = 1.0 * x - 4 + Noise:Normal Distributed mean = 0, var = 5 ``` %matplotlib inline import numpy as np import pylab size = 1000 x = np.ra...
github_jupyter
``` import cv2 import numpy as np from sklearn.feature_extraction import image import matplotlib.pyplot as plt from scipy.ndimage import shift from tqdm import tqdm #im,side = (cv2.imread("fluor.jpg"),20) #im,side = (cv2.imread("crystal.jpg"),17) im,side = (cv2.imread("lego_512.jpg"),17) #im,side = (cv2.imread("chess....
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Gena/landsat_median.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="ht...
github_jupyter
<a href="https://colab.research.google.com/github/nmningmei/Deep_learning_fMRI_EEG/blob/master/10_1_searchlight_representational_similarity_analysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # The script to illustrate a way to perform searchli...
github_jupyter
# KNeighborsRegressor with Normalize & PolynomialFeatures This Code template is for the regression analysis using a simple KNeighborsRegressor where separate rescaling is done using Normalize and feature transformation is done using PolynomialFeatures in a pipeline. ### Required Packages ``` import warnings import...
github_jupyter
# Incremental RV and Quality The incremental functions split up the spectrum into small sections an calculate the precision on each. This enables the change in each precision/quality accross the whole wavelength range to be observed. These were inspired by the plots in Bouchy 2001 and Artigau 2018. Here we show how t...
github_jupyter
# Grover's Search Algorithm このチュートリアルでは、シミュレータとイオントラップの実機でGroverの量子アルゴリズムについて学んでいきます。Braket SDKを使用して、単純なモジュラービルディングブロックの量子回路を構築する方法を示します。 具体的には、SDKが提供する基本的なゲートセットを組み合わせたカスタムゲートを構築する方法を示します。 カスタムゲートは、サブルーチンとして登録することにより、コア量子ゲートとして使用できます。 回路を構築した後、シミュレータとIonQの2種類のデバイスで実行します。 後者については、キューで待機している可能性のあるQuantum taskを復元する方法を示...
github_jupyter
# Naive Bayes Naive Bayes refers to the use of Bayes' theorem with naive independence assumptions between features. Naive Bayes classifers are popular for categorizing text. The goal of this module is to learn the basics of Naive Bayes. The module is split into a few sections: + Prepare the data for analysis + Intro...
github_jupyter
# Conditionals - also called logical statements that help program make decision and control the execution of commands ## One-way selection ```bash if a_command; then command1 command2 fi ``` if `a-command` executed successfully with exit status 0 then execute `command1` and `command2` ## Exit status - comman...
github_jupyter
# Advanced: `DAGConfigurator` Out of the box, `DAG` has just a few customizable parameters. `DAGConfigurator` provides more way to customize DAGs, the rationale for creating a new object instead of just adding more parameters to the DAG constructor is to keep the API simple for new users who might not even need to use...
github_jupyter
#### Copyright 2017 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 writin...
github_jupyter
# Creating TFRecords **Author:** [Dimitre Oliveira](https://www.linkedin.com/in/dimitre-oliveira-7a1a0113a/)<br> **Date created:** 2021/02/27<br> **Last modified:** 2021/02/27<br> **Description:** Converting data to the TFRecord format. ## Introduction The TFRecord format is a simple format for storing a sequence of...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt from prml.utils.datasets import load_mnist,load_iris from prml.continuous_latent_variables import ( PCA, ProbabilisticPCA, ProbabilisticPCAbyEM, FactorAnalysis, KernelPCA ) ``` # PCA ``` X,y = load_iris() pca = PCA() X_proj = pca.fit_trans...
github_jupyter
Halite is an online multiplayer game created by Two Sigma. In the game, four participants command ships to collect an energy source called **halite**. The player with the most halite at the end of the game wins. In this tutorial, as part of the **[Halite competition](https://www.kaggle.com/c/halite/overview)**, you'...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys import os import numpy as np import pandas as pd from matplotlib import pyplot as plt from pprint import pprint # time series specific from sktime.forecasting.naive import NaiveForecaster from sktime.utils.plotting import plot_series from sktime.forecasting.model_sele...
github_jupyter
``` BATCH_SIZE = 250 import os import cv2 import torch import numpy as np def load_data(img_size=112): data = [] index = -1 labels = {} for directory in os.listdir('./data/'): index += 1 labels[f'./data/{directory}/'] = [index,-1] print(len(labels)) for label in labels: f...
github_jupyter
<a id="introduction"></a> ## Introduction to Clustering #### By Paul Hendricks ------- Clustering is an important technique for helping data scientists partition data, especially when that data doesn't have labels or annotations associated with it. Since these data often don't have labels, clustering is often describe...
github_jupyter
``` from heapq import * from numpy import random class State: def __init__(self): self.green = False self.cars = 0 def is_green(self): """ True if the light is green """ return self.green def add_car(self): """ Adds a car in the queue "...
github_jupyter
# Comparison: Reinforced learning vs Dynamic programming Dynamic programming can be used to solve a life cycle model, as shown by Määttänen (2013). Here we compare a rather simple grid based method to solve _unemployment-v0_ environment, and compare the results againt those obtained by Reinforced Learning. Tarkastell...
github_jupyter
ESTIMATE TOTAL MEMORY USAGE: 2400 MB ``` %load_ext autoreload %autoreload 2 %matplotlib inline import numpy as np import pandas as pd import matplotlib.pylab as plt ``` # Goals of this notebook * Build our first classification model and evaluate it on the hold-out sets. * Try various features and understand what th...
github_jupyter
<a href="https://colab.research.google.com/github/Kur1sutaru/oncogenic-pathways-and-MPS/blob/main/cmap_repositioning_results.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import seaborn as sns import matplotlib.pyplot as plt sns.set() plt.figu...
github_jupyter
``` from IPython.display import display, Image, SVG from keras.models import load_model def loadModel(modelPath): """ Loads the model `modelPath`. """ model = load_model(modelPath) return model def getLayerConfig(layer): """ Extract configuration from `layer`. """ layerType = layer...
github_jupyter
# Examination of importance weight collapse as function of dimensionality This notebook visualizes the collapse of importance weights for high-dimensional density functions. The visualization uses separable Gaussians. ``` %matplotlib inline from IPython.display import display import torch import numpy as np import pa...
github_jupyter
# Analysis ``` !pip install textstat !pip install lexicalrichness !pip install textblob !pip install spacy %load_ext autoreload %autoreload 2 import pandas as pd import statistics import textstat from lexicalrichness import LexicalRichness import re from collections import defaultdict, Counter import matplotlib.pyplo...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#General-Information" data-toc-modified-id="General-Information-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>General Information</a></span></li><li><span><a href="#Defined-constants-and-temperature-depe...
github_jupyter
``` import uuid import json roiIndex = 1 cellIndex = 1 def get_annotation(filename): with open(filename) as f: data = json.load(f) f.close() return data['regions'] def get_rois(regions,tagGroup,formatNameLookup): rois = [] index = 0 global roiIndex for region in regions...
github_jupyter
# Multiclass classification with Amazon SageMaker XGBoost algorithm _**Single machine and distributed training for multiclass classification with Amazon SageMaker XGBoost algorithm**_ --- --- ## Contents 1. [Introduction](#Introduction) 2. [Prerequisites and Preprocessing](#Prequisites-and-Preprocessing) 1. [Permi...
github_jupyter
``` from utils import show_q ``` # Part 1 ``` show_q(2020, 1) ``` ## Solution The naive solution that comes to mind is to simply compare all numbers and individually check if they sum up to 2020. But that solution needs $O(k^2)$ comparisons for $k$ numbers as input. So how can we do better? One clue is that if yo...
github_jupyter
# IBM Advanced Data Science Capstone ## Recognition of Handwritten in Keras ## By Yuliia Hetman ## Overview Offline Handwritten Text Recognition (HTR) systems transcribe text contained in scanned images into digital text. Off-line handwriting recognition involves the automatic conversion of text in an image into let...
github_jupyter
``` %matplotlib inline ``` # Example plot for LFPy: Single-synapse contribution to the LFP Copyright (C) 2017 Computational Neuroscience Group, NMBU. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation,...
github_jupyter
# Neighbors of neighbors In this notebook, we demonstrate how neighbor-based filters work in the contexts of measurements of cells in tissues. We also determine neighbor of neighbors and extend the radius of such filters. ``` import pyclesperanto_prototype as cle import numpy as np import matplotlib from numpy.random...
github_jupyter
``` %matplotlib inline from caffe.proto import caffe_pb2 from caffe2.proto import caffe2_pb2 from cStringIO import StringIO from google.protobuf import text_format from IPython import display import matplotlib.image as mpimg from matplotlib import pyplot import numpy as np import os from caffe2.python import caffe_tran...
github_jupyter
Plot a distribution of the S/N in the H$\alpha$ flux for all the galaxies used in the analysis of the second rotation curve paper (all the galaxies with valid map fits). ``` import numpy as np import numpy.ma as ma from astropy.table import Table import matplotlib.pyplot as plt %matplotlib notebook import sys sys.p...
github_jupyter
# Training a SSD MobileNet V2 for Pedestrian Detection with TensorFlow Object Detection API This notebook shows how to train a SSD MobileNet V2 object detector for pedestrian detection with [TensorFlow Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection). The TensorFlow Obj...
github_jupyter
``` import pymc3 as pm import pandas as pd import matplotlib.pyplot as plt import fmax as fm import numpy as np import arviz as az def plot_posterior_predictive(fcast_model, label): """Simple plot of the posterior predictive of a forecast model. """ sample_paths = fcast_model.posterior_predictive_samples ...
github_jupyter
``` # imports import pandas as pd import numpy as np # Viz imports import matplotlib.pyplot as plt import seaborn as sns # Config matplotlib %matplotlib inline plt.rcParams["patch.force_edgecolor"] = True # in matplotlib, edge borders are turned off by default. sns.set_style("darkgrid") # set a grey grid as a backgro...
github_jupyter
``` from math import exp from sympy.stats import E, variance, Die, Normal, Binomial from sympy.stats import P as Prob import matplotlib.pyplot as plt ``` ### terminology * 'negative' ~ $y=0$ * 'positive' ~ $y=1$ * 'natural' ~ a sample from $X=X_1 + Lap\left(0, \frac{\Delta f}{\epsilon_\text{true}}\right)$ * 'altern...
github_jupyter
# 1D-CNN Model for ECG Classification - The model used has 2 Conv. layers and 2 FC layers. - This code repeat running the training process and produce all kinds of data which can be given, such as data needed for drawing loss and accuracy graph through epochs, and maximum test accuracy for each run. ## Get permission ...
github_jupyter
# `pororo`를 사용한 한글 자연어 처리 *아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.* <table class="tfo-notebook-buttons" align="left"> <td> <a target="_blank" href="https://nbviewer.jupyter.org/github/rickiepark/nlp-with-pytorch/blob/master/pororo_nlp.ipynb"><img src...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
github_jupyter
### Preprocess preprocess the screenshot files in the img/ directory to separate the front camera view, as well as the left and right side mirror views. the csv file is also modified to represent the preprocessed images. let's open the csv file ``` %ls -lh ../data/csv import pandas as pd import os parent_path = os....
github_jupyter
# TF-IDF https://en.wikipedia.org/wiki/Tf%E2%80%93idf TFIDF (Term Frequency - Inverse Document Frequency) is a statistical method used to quantify the importance of words within a given text, compared to a background corpus. How does this work? https://triton.ml/blog/tf-idf-from-scratch ## TF-IDF from scratch Fir...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '2' n_gpus = len(os.environ['CUDA_VISIBLE_DEVICES'].split(',')) model_name = 'ception_8classifier_trained' trainval_split_ratio = 0.90 train_batch_size =16 import keras.backend as K import tensorflow as tf # gpu_options = tf.GPUOptions(per_process_gpu_memory_fractio...
github_jupyter
# Semi-supervised Self-learning Classification with Iris Dataset ``` import os import shutil import numpy as np import pandas as pd import tensorflow as tf print(tf.__version__) ``` ## Get data ``` TRAIN_URL = "http://download.tensorflow.org/data/iris_training.csv" TEST_URL = "http://download.tensorflow.org/data/iri...
github_jupyter
``` % pylab inline import os import random import pandas as pd from scipy.misc import imread #import imshow train=pd.read_csv('train.csv') test=pd.read_csv('test.csv') i=random.choice(train.index) img_name = train.ID[i] img = imread(os.path.join('Train', img_name)) print "Age: ", train.Class[i] imshow(img) from scipy...
github_jupyter
``` from __future__ import division, print_function %matplotlib inline ``` # Color and exposure ``` import matplotlib.pyplot as plt import numpy as np ``` ## <span style="color:cornflowerblue">Exercise:</span> Create three images; each should display a red, green, or blue channel of the original image. ``` import ...
github_jupyter
``` import numpy as np class Point: """A point located at (x,y) in 2D space. Each Point object may be associated with a payload object. """ def __init__(self, x, y, payload=None): self.x, self.y = x, y self.payload = payload def __repr__(self): return '{}: {}'.format(str...
github_jupyter
# GP11: Analyzing Movie Reviews ## 1. Read in Data ``` import pandas movies = pandas.read_csv("../data/GP11/fandango_score_comparison.csv") movies.head(5) ``` ## 2. Histograms ``` import matplotlib.pyplot as plt %matplotlib inline plt.hist(movies["Fandango_Stars"]) plt.hist(movies["Metacritic_norm_round"]) ``` #...
github_jupyter
<h1>Data Preprocessing Tools</h1> **Importing the Libararies** ``` # Numpy allows us to work with array. import numpy as np # Maptplotlib which allows us to plot some chart. import matplotlib.pyplot as plt # Pandas allows us to not only import the datasets but also create the matrix of features(independent) and # ...
github_jupyter
<a href="https://colab.research.google.com/github/PytorchLightning/pytorch-lightning/blob/master/notebooks/03-basic-gan.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # PyTorch Lightning Basic GAN Tutorial ⚡ How to train a GAN! Main takeaways: 1....
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
# Navigation --- Congratulations for completing the first project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893)! In this notebook, you will learn how to control an agent in a more challenging environment, where it can learn directly from...
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
# Using DALI in PyTorch ### Overview This example shows how to use DALI in PyTorch. This example uses CaffeReader. See other [examples](..) for details on how to use different data formats. Let us start from defining some global constants ``` import os.path test_data_root = os.environ['DALI_EXTRA_PATH'] # Caffe ...
github_jupyter
# Backscattering Efficiency Validation **Scott Prahl** **Apr 2021** *If miepython is not installed, uncomment the following cell (i.e., delete the #) and run (shift-enter)* ``` #!pip install --user miepython import numpy as np import matplotlib.pyplot as plt try: import miepython except ModuleNotFoundError: ...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/4_image_classification_zoo/Classifier%20-%20Caltech-256%20dataset.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Table of contents ## Instal...
github_jupyter
# Character-Level LSTM in PyTorch In this notebook, I'll construct a character-level LSTM with PyTorch. The network will train character by character on some text, then generate new text character by character. As an example, I will train on Anna Karenina. **This model will be able to generate new text based on the te...
github_jupyter
<table> <tr> <td style="background-color:#ffffff;"><a href="https://qsoftware.lu.lv/index.php/qworld/" target="_blank"><img src="..\images\qworld.jpg" width="70%" align="left"></a></td> <td style="background-color:#ffffff;" width="*"></td> <td style="background-color:#ffffff;vertical-align...
github_jupyter
<table> <tr> <td style="background-color:#ffffff;"> <a href="http://qworld.lu.lv" target="_blank"><img src="..\images\qworld.jpg" width="25%" align="left"> </a></td> <td style="background-color:#ffffff;vertical-align:bottom;text-align:right;"> prepared by <a href="http://abu.lu....
github_jupyter
# Building a Model to Detect Randomly Generated Domains ``` # Import Needed Modules import pandas as pd import numpy as np from sklearn import preprocessing from sklearn.model_selection import cross_val_score from sklearn import linear_model from sklearn.ensemble import RandomForestClassifier import math import re # L...
github_jupyter
``` import time import random # Set seed. random.seed(a=100) # Create our default list. short_list = list(random.sample(range(1000000), 10)) long_list = list(random.sample(range(1000000), 10000)) ``` Now that we've covered some basic data structures, let's get into the things we can _do_ with those structures a litt...
github_jupyter
<img src="../../../img/logo-bdc.png" align="right" width="64"/> # <span style="color: #336699">Land use and land cover classification in the Brazilian Cerrado biome using Brazil Data Cube</span> <hr style="border:2px solid #0077b9;"> <br/> <div style="text-align: center;font-size: 90%;"> Rolf E. O. Simões <sup><...
github_jupyter
# ML Pipeline Preparation Follow the instructions below to help you create your ML pipeline. ### 1. Import libraries and load data from database. - Import Python libraries - Load dataset from database with [`read_sql_table`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_sql_table.html) - Define fea...
github_jupyter
``` from RzLinear import RzLinearFunction import torch from RzLinear import RzLinear import torch.nn as nn import numpy as np import matplotlib.pyplot as plt import rz_linear import os os.environ["CUDA_VISIBLE_DEVICES"] = '4' DEV=0 TILED = True input_dim = 40000 output_dim = 500 weight_size = 1000000 chunk_size = 2 r ...
github_jupyter
# Compressing an image Often we may need to compress a file to reduce the size of the given data. We have two options: - **lossy** compression which is a method of data compression in which the size of the file is reduced by eliminating data in the file (thus, lowering quality). - **lossless** which is a class of da...
github_jupyter
``` # @title Imports from dataclasses import dataclass from pprint import pprint from typing import Any, List, Callable, Dict, Sequence, Optional, Tuple from io import BytesIO from IPython.display import display, HTML from base64 import b64encode import PIL import IPython import tempfile import imageio import numpy a...
github_jupyter
# 하이퍼 매개 변수 튜닝 다수의 기계 학습 알고리즘에는 *하이퍼 매개 변수*가 필요합니다. 하이퍼 매개 변수란 학습에는 영향을 주지만 학습 데이터 자체에서는 확인할 수 없는 매개 변수 값입니다. 예를 들어 로지스틱 회귀 모델 학습 시에는 *정규화 비율* 하이퍼 매개 변수를 사용하여 모델의 바이어스를 완화할 수 있습니다. 그리고 콘볼루션 신경망 학습 시에는 *학습 속도*, *일괄 처리 크기* 등의 하이퍼 매개 변수를 사용하여 가중치 조정 방식과 미니 배치에서 처리되는 데이터 항목의 수를 각각 제어할 수 있습니다. 선택하는 하이퍼 매개 변수 값에 따라 학습된 모델...
github_jupyter
``` %matplotlib inline from pandas_datareader import data import pandas as pd from SALib.sample import latin from stockmarket.stylizedfacts import * from stockmarket.evolutionaryalgo import * from tqdm import tqdm import matplotlib.pyplot as plt ``` # Evolutionary algorithm to calibrate model ## 1 get data from S&P50...
github_jupyter
<p><font size="6"><b>Jupyter notebook INTRODUCTION </b></font></p> > *Introduction to GIS scripting* > *May, 2017* > *© 2017, Stijn Van Hoey (<mailto:stijnvanhoey@gmail.com>). Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)* --- ``` from IPython.display import Image Image...
github_jupyter
# Prototypical problem $$ -u_h''(x) = f(x)\ \mathrm{ in }\ [0,1] $$ $$ u_h(0) = 0, \quad u_h(1) = 0 $$ We start by considering a uniform discretisation of the interval $[0,1]$ using $n$ equispaced *sample points* (to construct first a **Finite Difference Approximation**). ``` %matplotlib inline from numpy import * ...
github_jupyter
# Time-variant global reliability sensitivity analysis of structures with both input random variables and stochastic processes : ## Method validation on included numerical example. In the paper above, their method is tested on a simple numerical example. ``` import numpy as np import openturns as ot # from numba imp...
github_jupyter
# Informer Demo ## Download code and dataset ``` !git clone https://github.com/zhouhaoyi/Informer2020.git !git clone https://github.com/zhouhaoyi/ETDataset.git !ls import sys if not 'Informer2020' in sys.path: sys.path += ['Informer2020'] # !pip install -r ./Informer2020/requirements.txt ``` ## Experiments: Trai...
github_jupyter
``` import pandas as pd import os s3_prefix = "s3://aegovan-data/pubmed_asbtract/predictions_multi_ppi-bert-2021-01-02-08_m_2021010514/" s3_output_prefix = "{}_summary/".format(s3_prefix.rstrip("/")) s3_data ="s3://aegovan-data/human_output/human_interactions_ppi_v2.json" local_temp = "temp" local_temp_pred_dir = os.pa...
github_jupyter
``` import os import numpy as np import scipy as sp import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import seaborn as sns import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) %matplotlib inline mpl.style.use('ggplot') sns.set(style='whitegrid') df = pd.read_csv("....
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
github_jupyter
# Evaluación del tiempo de atención a incidentes viales Se trabajó con el dataset "" que contiene los datos de los reportes de incidentes viales de la ciudad de México de los años 2016 a 2021 realizados por el c4. Este dataset fue preprocesdado durante el módulo anterior. ``` # Importar librearías import pandas as p...
github_jupyter
# What's New in Marvin 2.1 ## Marvin is Python 3.5+ compliant! ``` import matplotlib %matplotlib inline # only necessary if you have a local DB from marvin import config config.forceDbOff() ``` # Web ## Interactive NASA-Sloan Atlas (NSA) Parameter Visualization http://www.sdss.org/dr13/manga/manga-target-selection/...
github_jupyter
# Diabetes Prediction using Logistic Regression ### Importing Libraries ``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.metrics import jaccard_similarity_score from sklearn.metrics import mean_squared_erro...
github_jupyter
``` import datetime import time import copy import random import sys import numpy as np ``` # Problem description This file include a toy example in RL. Given a matrix of NxM like following, [0, 0, 0, 0, 0] [ 5, #, 0, 0, 0] [0, 0, ...
github_jupyter
# Parameterized inference with nuisance parameters Gilles Louppe, March 2016. ``` %matplotlib inline import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (7, 7) plt.set_cmap("viridis") import itertools import numpy as np from carl.distributions import Normal from carl.data import GK true_A = 3. # Par...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/FeatureCollection/get_properties.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_bla...
github_jupyter
# Mask R-CNN - Train on Shapes Dataset This notebook shows how to train Mask R-CNN on your own dataset. To keep things simple we use a synthetic dataset of shapes (squares, triangles, and circles) which enables fast training. You'd still need a GPU, though, because the network backbone is a Resnet101, which would be ...
github_jupyter
# Propagation of uncertainty (error) > Marcos Duarte > Laboratory of Biomechanics and Motor Control ([http://demotu.org/](http://demotu.org/)) > Federal University of ABC, Brazil > The result of a measurement is only an approximation or estimate of the value of the measurand and thus is complete only when accompa...
github_jupyter
``` import numpy as np import math import os import time from sklearn import mixture # import custom functions import sys # path to libraries # currently in ../scripts-lib/ tool_path = os.path.abspath('../scripts-lib') if tool_path not in sys.path: sys.path.append(tool_path) import lib_phones as lph # print the l...
github_jupyter