text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Generate data based on BrainWeb images From brainweb, get: - Two PET images - FDG - Amyloid - Two MR acquisitions: - T1 - T2 - A $\mu$-map We're going to do various things with the images to create some data we can play around with! In image space, this includes: - adding misalignment to some image...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/4_image_classification_zoo/Classifier%20-%20Cats%20vs%20Dogs.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Table of contents ## Install Mon...
github_jupyter
``` dataset = 'ImageNet16-120' # choose between 'ImageNet16-120', 'cifar10' and 'cifar100' data_loc = '../datasets/ImageNet16' # choose ImageNet16 for ImageNet16-120 and cifar for cifar10 and cifar100 api_loc = '../datasets/NAS-Bench-201-v1_1-096897.pth' n_runs = 500 n_init = 100 n_samples = 1000 batch_size = 256 train...
github_jupyter
### TF-IDF model ``` # load all necessary libraries import pandas as pd from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from sklearn.feature_extraction.text import TfidfVectorizer pd.set_option('max_colwidth', 100) ``` #### Let's build a basic bag of words model on three sample documents `...
github_jupyter
# CS 410 Final Project: Aspect Based Sentiment Analysis ## Cristian Jansenson ## Peter Tsapatsaris The application contained in this notebook performs two tasks: (1) parses customer reviews into specified aspects (e.g., "screen", "camera", "value"), such that phrases are extracted that are assocaited with the relev...
github_jupyter
<!--NAVIGATION--> < [How to Build Your Own Automated Trading System in Python With OANDA API](00.00 How to Build Your Own Automated Trading System in Python With OANDA API.ipynb) | [Contents](Index.ipynb) | [Rates Information](02.00 Rates Information.ipynb) > # Setting Up Before we start, there are a few parts that w...
github_jupyter
# Interactive Plot # Description Allows interactive plotting of multidimensional data ``` %%checkall # Library Imports import os import sys import math import colorsys from dataclasses import dataclass import unittest import doctest import pandas as pd import numpy as np from IPython.core.display import display from...
github_jupyter
``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from scipy.misc import toimage from keras.datasets import cifar10 import keras.utils as Kutils import tensorflow as tf from keras.backend import set_session,tensorflow_backend config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True,v...
github_jupyter
# Comparison of PyBaMM and COMSOL Discharge Curves In this notebook we compare the discharge curves obtained by solving the DFN model both in PyBaMM and COMSOL. Results are presented for a range of C-rates, and we see an excellent agreement between the two implementations. If you would like to compare internal variabl...
github_jupyter
# System requirements **Create virtual environment** *python3.6 -m venv {Virtual Env Name} or {Absolute Path for Virtual Env}* Ex: python3.6 -m venv azar or python3.6 -m venv Users/azar-0000/python/azar **cd to venv directory** *cd azar* or *Users/azar-0000/python/azar* **Activate virtual environment** *source ...
github_jupyter
``` import calibrimbore as cal import numpy as np import matplotlib.pyplot as plt #%matplotlib notebook filt = '/Users/rridden/Documents/work/code/source_synphot/source_synphot/passbands/Kepler/Kepler_k.dat' filt = '/Users/rridden/Documents/work/code/source_synphot/source_synphot/passbands/TESS/tess.dat' filt = '/Use...
github_jupyter
``` import math import random import numpy as np import matplotlib import matplotlib.pyplot as plt from collections import namedtuple from itertools import count from PIL import Image import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torchvision.transforms as T impo...
github_jupyter
``` import dataclasses from pathlib import Path import nlp import torch import numpy as np from transformers import BertTokenizerFast from transformers import BertForSequenceClassification from torch.optim.lr_scheduler import CosineAnnealingLR try: from apex import amp APEX_AVAILABLE = True except ModuleNotFo...
github_jupyter
<img src='./img/EU-Copernicus-EUM_3Logos.png' alt='Logo EU Copernicus EUMETSAT' align='right' width='50%'></img> <br> <a href="./341_ltpy_Ozone_hole_case_study.ipynb"><< 341 - 2019 Antarctic ozone hole case study </a><span style="float:right;"><a href="./index_ltpy.ipynb">Index >></a></span> # 3.4.2 Ozone hole case...
github_jupyter
``` from datetime import datetime import logging import os import random import math import torch from torch import nn from torch.utils.data import DataLoader from torch.utils.data.sampler import SubsetRandomSampler import torchvision from torchvision import transforms from mylogger import create_logger from net.mob...
github_jupyter
``` from IPython.core.display import HTML from IPython.display import Image HTML(""" <style> .output_png { display: table-cell; text-align: center; vertical-align: middle; } </style> """) ``` # *Circuitos Elétricos I* ## Semana 1 - Convenções para aplicação das Leis de Kirchhoff na análise de circuitos ...
github_jupyter
``` %matplotlib inline import numpy as np import pylab as plt from psi import application as app from psi.controller.calibration import tone from psi.controller.calibration.api import FlatCalibration, PointCalibration from psi.controller.calibration.util import load_calibration, psd, psd_df, db, dbi, dbtopa, rms from ...
github_jupyter
# Complex Arithmetic This is a tutorial designed to introduce you to complex arithmetic. This topic isn't particularly expansive, but it's important to understand it to be able to work with quantum computing. This tutorial covers the following topics: * Imaginary and complex numbers * Basic complex arithmetic * Comp...
github_jupyter
``` import torch import torch.nn as nn from torch.nn import functional as F from torch.autograd import Variable from torch.utils.data import Dataset, DataLoader import json import numpy as np import random import matplotlib.pyplot as plt import numpy as np from scipy.stats import pearsonr from sklearn.metrics import f1...
github_jupyter
# Lunar Rock Classfication ``` # Installing latest Tensor-flow !pip install -U tensorflow-gpu # Mount for Google Colab from google.colab import drive drive.mount('/content/drive',force_remount=True) # Dependencies import tensorflow as tf from tensorflow import keras from tensorflow.keras.models import Sequential from...
github_jupyter
<a href="https://colab.research.google.com/github/BachiLi/redner/blob/master/tutorials/hello_redner_tensorflow.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> This is the first tutorial of redner. In this tutorial we will load a 3D object and render...
github_jupyter
# 🏷️ 🔫 Faster data annotation with a zero-shot text classifier ## TL;DR 1. A simple example for data annotation with Rubrix is shown: **using a zero-shot classification model to pre-annotate and hand-label data more efficiently**. 2. We use the new **SELECTRA zero-shot classifier** and the Spanish part of the **MLS...
github_jupyter
# An Introduction to PCA with MNIST _**Investigating Eigendigits from Principal Components Analysis on Handwritten Digits**_ 1. [Introduction](#Introduction) 2. [Prerequisites and Preprocessing](#Prequisites-and-Preprocessing) 1. [Permissions and environment variables](#Permissions-and-environment-variables) 2. [D...
github_jupyter
# Data Preparation [Original Notebook source from *Data Science: Introduction to Machine Learning for Data Science Python and Machine Learning Studio by Lee Stott*](https://github.com/leestott/intro-Datascience/blob/master/Course%20Materials/4-Cleaning_and_Manipulating-Reference.ipynb) ## Exploring `DataFrame` inform...
github_jupyter
# Download Daymet Daymet provides gridded meteorological data for North American at 1km spatial resolution with daily timestep from 1980 ~ present. [website](https://daac.ornl.gov/cgi-bin/dsviewer.pl?ds_id=1328) and [user guide](https://daac.ornl.gov/DAYMET/guides/Daymet_V3_CFMosaics.html) Available variables: | Var...
github_jupyter
<figure> <center> <img src='https://raw.githubusercontent.com/Alex-Snow-School-Lab/Python-Basics/master/cover%20ppt.png' width = '800px'/> </center> </figure> #**Assignment 3 (Mini project)>=5 **Assigned Date - 18 July 2020 (9:00 PM)** **Self-Interactive Due Date - 24 July 2020 (11:59:59 AM)** **Self-Paced Due Date ...
github_jupyter
# TEXT MINING for PRACTICE - 본 자료는 텍스트 마이닝을 활용한 연구 및 강의를 위한 목적으로 제작되었습니다. - 본 자료를 강의 목적으로 활용하고자 하시는 경우 꼭 아래 메일주소로 연락주세요. - 본 자료에 대한 허가되지 않은 배포를 금지합니다. - 강의, 저작권, 출판, 특허, 공동저자에 관련해서는 문의 바랍니다. - **Contact : ADMIN(admin@teanaps.com)** --- ## WEEK 03-2. 정적 페이지 수집하기: 영화댓글 - Python을 활용해 단순한 웹페이지에서 데이터를 크롤링하는 방법에 대해 다룹니다. ...
github_jupyter
An algorithm is any well-defined computational procedure that takes a set of values as input and produces a set of values as output. Tool to solve a well-specified computational problem. Eg: sorting problem: Input: sequence n numbers $a_1, a_2$, ..., $a_n$. Output: Reordering of the sequence $a_1', a_2'$, ..., $...
github_jupyter
``` import os import sys import itertools import time import multiprocessing as mp ``` # Test the limits: Using tmpfiles named in local tempfiles (one for each paralell process) ## Attention Candidate Object - tempfile ## Attention Candidate adjacency-matrix | priority-forces-network ```python """ Extracted from: ...
github_jupyter
<small><small><i> All the IPython Notebooks in this lecture series by Dr. Milan Parmar are available @ **[GitHub](https://github.com/milaan9/01_Python_Introduction)** </i></small></small> # Python Variables and Constants In this class, you will learn about Python variables, constants, literals and their use cases. #...
github_jupyter
Viscoplastic thermal convection in a 2-D square box: Tosi et al. 2015 ===== This series of notebooks generates benchmark models from the Tosi et al. (2015) in Underworld2. The Underworld2 results are then directly compared to the results from Table 2 of Tosi et al. (2015) the paper for each case. The notebooks are bro...
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
The concepts to be introduced in this notebook, such as the Ising model, simulated annealing, and the transverse Ising model, play an important role in today's quantum algorithms and quantum computing paradigms, including quantum annealing, the quantum approximate optimization algorithm, and quantum-enhanced sampling. ...
github_jupyter
# Random Forest Model The previous discussion on Decision Tree Model will give us intuition about a Random Forest Model. Random Forest focuses on feature selection and is a supervised learning algorithm. It can be used for both classification and regression. Random Forest helps us reduce the variance in decision tre...
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 fro...
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
# Descriptor evaluation on the RDNIM dataset ``` import cv2 import numpy as np import matplotlib.pyplot as plt import brewer2mpl from lisrd.evaluation.descriptor_evaluation import run_descriptor_evaluation %matplotlib inline %load_ext autoreload %autoreload 2 ``` ## Day reference ``` config = { 'name': 'rdnim',...
github_jupyter
# Implementation of pytorch network # Imports ``` import os import torch import mlflow import numpy as np import pandas as pd import plotly.express as px from itertools import product from torch import nn, cuda, optim, no_grad import torch.nn.functional as F from torchvision import transforms from torchvision.dataset...
github_jupyter
# Quantum Kernel Training for Machine Learning Applications In this tutorial, we will train a quantum kernel on a labeled dataset for a machine learning application. To illustrate the basic steps, we will use Quantum Kernel Alignment (QKA) for a binary classification task. QKA is a technique that iteratively adapts a ...
github_jupyter
# GeoEnrichment GeoEnrichment provides the ability to * get facts about a location or area. * information about the people, places, and businesses * in a specific area or * within a certain distance or drive time from a location. * large collection of data sets including population, income, housing, consumer beh...
github_jupyter
## Dependencies ``` import os import sys import cv2 import shutil import random import warnings import numpy as np import pandas as pd import seaborn as sns import multiprocessing as mp import matplotlib.pyplot as plt from tensorflow import set_random_seed from sklearn.utils import class_weight from sklearn.model_sele...
github_jupyter
``` %load_ext watermark %watermark -i -h -m -v -p numpy,torch,POLO -r -g -b import numpy as np import matplotlib.pyplot as plt %matplotlib inline mode='nearest' width = 32 base_levels = 1.61803 base_levels = 2 n_sublevel = 2 n_azimuth = 18 n_theta = 8 n_phase = 2 N_batch = 1024 minibatch = 64 #N_batch = 128 #N_batch ...
github_jupyter
# Basic SoS workflows * **Difficulty level**: easy * **Time need to lean**: 10 minutes or less * **Key points**: * A forward-style workflow consists of numerically numbered steps * Multiple workflows can be defined in a single SoS script or notebook * Optional input and output statements can be added to change h...
github_jupyter
# Decorator --- ## Introduction 在進階的python程式碼中,可以透過裝飾器對函式進行裝飾,讓函式達到特定的變化。為了要讓各位邁向更高的程式設計的境界,在本節將會介紹裝飾器的使用。 不過在正式進入裝飾器的介紹前,我們要先了解幾個概念: 1. 在python中,函式也是一個可被賦值給變數,可作為參數傳遞,也可作為其他函數的回傳值。 2. 函式裡面可以再定義函式,我們稱其為子函式,而包含此子函式的函式為父函式。 ### 1.裝飾器介紹 --- 裝飾器可以用來修飾(或包裝)函式,可以增加額外的程式碼在被包裝的目標函式的之前或之後。 想像裝飾器是燈罩,加上燈罩之後,可以修改電燈照明範圍;你也...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import ta dataset_train = pd.read_csv('train.csv') dataset_train = dataset_train.drop(["Date","Turnover (Lacs)"], axis=1) RSI=ta.momentum.rsi(close=dataset_train['Close']) MFI=ta.volume.money_flow_index(dataset_train['High'], dataset_train['Low'...
github_jupyter
# Searching For Simple Patterns Being able to match letters and metacharacters is the simplest task that regular expressions can do. In this section we will see how we can use regular expressions to perform more complex pattern matching. We can form any pattern we want by using the metacharacters mentioned in the prev...
github_jupyter
# Activity Feed Details - Web Scraping >- It can be used free account to extract the information >- For this script you can use either a list of logins, or setup a unique login through the **Function** `change_user ()`, with `number_logins=1` and any login of your choice >- For a web scraping process is important to h...
github_jupyter
# Symbolic Math: Differentiation Program This notebook describes how to write a program that will manipulate mathematical expressions, with an emphasis on differentiation. The program can compute $\frac{d}{dx} x^2 + \sin(x)$ to get the result $2x + \cos(x)$. Usually in a programming language, when we say `sin(x)` w...
github_jupyter
# Linear Regression in Python There are two main packages you can use to run basic linear regression models in Python: [statsmodels](http://statsmodels.sourceforge.net/devel/examples/notebooks/generated/ols.html) and [scikit-learn](http://scikit-learn.org/stable/modules/linear_model.html#ordinary-least-squares). I'll ...
github_jupyter
<h1>Training Keras model on Cloud AI Platform</h1> This notebook illustrates distributed training on Cloud AI Platform. This uses Keras and requires TensorFlow 2.1 ``` # Ensure the right version of Tensorflow is installed. !pip freeze | grep tensorflow==2.1 ``` ## Set up environment variables and load necessary libr...
github_jupyter
# Performance Attribution In this exercise, we're going to use artificial data and a PCA risk model to show you the nuts and bolts of performance attribution. We use artificial data here so that you can focus on the calculations without having to worry about extra packages and data details. Let's get started! ``` impo...
github_jupyter
``` import pandas as pd # データフレームを読み込む df = pd.read_csv('USDJPY_TrailingStop2.csv', index_col='Date') df.index = pd.to_datetime(df.index) df.head() import time import numpy as np from numba import jit from keras.utils.np_utils import to_categorical # 特徴量を[Close[20], ATR(20)[20]]、目的変数をTrailingStop損益結果の4パターンとする @jit de...
github_jupyter
# Logistic Regression Logistic regression is an <b>algorithm of binary classification</b> used in a supervised learning problem when the output y are all either zero or one. (*For Example*: Cat vs No-cat). <br> The <b>goal</b> of logistic regression is to minimize the error between its predictions and training data. ...
github_jupyter
``` import pandas as pd from tqdm.auto import tqdm import numpy as np from slugify import slugify import ast from IPython.display import display, HTML import matplotlib.pyplot as plt import booleanize artists_df = pd.read_csv("data/artists.csv", keep_default_na=False) tracks_df = pd.read_csv("data/tracks.csv") playlist...
github_jupyter
``` %matplotlib inline import sys import numpy as np import math import matplotlib.pyplot as plt #Mathematical constants pi = np.pi tpi = 2.0*pi fpi = 4.0*pi zI = 1.0j #Physical constants #https://ja.wikipedia.org/wiki/%E5%8E%9F%E5%AD%90%E5%8D%98%E4%BD%8D%E7%B3%BB aB = 0.0529177210903 #nanometer Hartree = 27.2113862459...
github_jupyter
``` import csv import json import uuid import datetime import pandas as pd from lxml import etree from collections import defaultdict, Counter from tqdm import tqdm_notebook as tqdm import os import matplotlib.pyplot as plt import statistics import numpy as np from eMammal_helpers import clean_species_name, get_total_f...
github_jupyter
<a href="https://colab.research.google.com/github/dude123studios/AdvancedReinforcementLearning/blob/main/Deep%20Q%20networks.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import random import gym import numpy as np from collections import dequ...
github_jupyter
``` !curl https://topcs.blob.core.windows.net/public/FlightData.csv -o flightdata.csv import pandas as pd df = pd.read_csv('flightdata.csv') df.head() df.shape df.isnull().values.any() df = df.drop('Unnamed: 25', axis=1) df.isnull().sum() df = df[["MONTH", "DAY_OF_MONTH", "DAY_OF_WEEK", "ORIGIN", "DEST", "CRS_DEP_TIME...
github_jupyter
# 10. 다양한 데이터 전처리 기법 **EDA를 통해 도출된 데이터 인사이트를 토대로, 효과적인 Feature Engineering을 위해 사용하는 Encoding, Scaling, Feature Selection 등의 전처리 기법을 실습해 본다.** ## 10-1. 들어가며 ```bash $ mkdir -p ~/aiffel/data_preprocess/ $ ln -s ~/data/ ~/aiffel/data_preprocess/ ``` ``` import pandas as pd import numpy as np import matplotlib.pyplot a...
github_jupyter
##### Copyright 2018 The TensorFlow Authors. Licensed under the Apache License, Version 2.0 (the "License"). # Text generation using a RNN with eager execution <table class="tfo-notebook-buttons" align="left"> <td> <a target=\"_blank\" href="https://www.tensorflow.org/tutorials/sequences/text_generation"><img src...
github_jupyter
``` import pandas as pd import missingno as msno import numpy as np import matplotlib.pyplot as plt import seaborn as sns df = pd.read_csv('../../fixtures/raw_data/2019projections.csv') # see how many rows and columns are in this dataset shape_info = df.shape # set the dataframe's "shape" to a variable print('This dat...
github_jupyter
``` import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from sklearn.metrics import roc_curve from sklearn.model_selection import GridSearchCV from sklearn.neighbors import KNeighborsClassifier from sklearn.neighbors import RadiusNeighborsClassifier from sklearn.linear_model ...
github_jupyter
``` import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import tensorflow as tf from tensorflow.keras.utils import to_categorical from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequence...
github_jupyter
<a href="https://colab.research.google.com/github/SidharthArya/Deep_Learning_Class_Manit/blob/main/Assignments/005_Transfer_Functions.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import numpy as np import matplotlib.pyplot as plt from matplot...
github_jupyter
``` import fnmatch import os import re import numpy as np import pandas as pd from matplotlib import cm import seaborn as sns def get_val_losses(file_list, col_ref='val_ou', avg_over=50, epochs=None): ''' Returns a concatenated array with arrays in the list. \n Concatenation will be performed along axis=1 ...
github_jupyter
![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/configuration.png) Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. # Configuration _**Setting up your Azure Machine Learning services workspace and configuring your n...
github_jupyter
# Pandas fast mutate architecture (Published 27 Oct 2019) ## Problem: series operations are type invariant under grouping ### What is type variance? In spirit, most pandas operations are one of two functions. * f_elwise(a, [b]) - takes up to two series, returns a result of the same length. * f_agg(a, [b]) - takes ...
github_jupyter
# Step 2.1: Experiment I: Machine Learning --- ## 1. Imports ``` import warnings warnings.filterwarnings('ignore') import math import numpy as np #operaciones matriciales y con vectores import pandas as pd #tratamiento de datos import random import matplotlib.pyplot as plt #gráficos import seaborn as sns import jobl...
github_jupyter
``` # !pip install nlp # !pip install bert_score # !pip install git+https://github.com/google-research/bleurt.git from pathlib import Path import pandas as pd import asyncio import aiohttp import json from aiohttp import ClientConnectorError, ClientSession from nlp import load_metric from sklearn.model_selection impor...
github_jupyter
# Deep Q Network with Pong DQN was created by DeepMind researchers, achieving superhuman performance on many Atari games (https://deepmind.com/research/dqn/). What made the accomplishments of DQN even more impressive is that the DQN had nearly the same architecture and hyperparameter settings for each game (ie no game...
github_jupyter
``` # default_exp tensorflow.tflite_converter # hide from nbdev.showdoc import * # export import logging import logging.handlers import argparse import sys from os.path import join from google.protobuf import text_format from aiforce.core import OptionalModule from aiforce.dataset.type import DatasetType, infer_dataset...
github_jupyter
``` %load_ext watermark %watermark -d -u -a 'Andreas Mueller, Kyle Kastner, Sebastian Raschka' -v -p numpy,scipy,matplotlib ``` The use of watermark (above) is optional, and we use it to keep track of the changes while developing the tutorial material. (You can install this IPython extension via "pip install watermar...
github_jupyter
#### Agenda - Given a sequence of previous characters, model the probability distribution of the next character in the sequence. Here we try harry potter text We will be using kears for this note ``` from __future__ import print_function import numpy as np import random import sys from keras.models import Sequenti...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Simpsons](https://en.wikipedia.org/wiki/The_Simpsons) TV scripts using RNNs. You'll be using part of the [Simpsons dataset](https://www.kaggle.com/wcukierski/the-simpsons-by-the-data) of scripts from 27 seasons. The Neural Network you'll build will gen...
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
``` !pip install --upgrade pip !pip install python-decouple !pip install geoalchemy2 !pip install shapely !pip install scipy !pip install hyperas from sqlalchemy import create_engine, func, text from sqlalchemy.orm import sessionmaker from decouple import config from shapely import wkb, wkt from shapely.geometry import...
github_jupyter
# Decision Trees in Practice In this assignment we will explore various techniques for preventing overfitting in decision trees. We will extend the implementation of the binary decision trees that we implemented in the previous assignment. You will have to use your solutions from this previous assignment and extend th...
github_jupyter
``` import pandas as pd import numpy as np import os model_name = 'k80' file_name = 'k80' DATA_DIR = os.path.abspath("../../../prediction_model/data/raw_data") SAVE_DIR = os.path.abspath("../../../prediction_model/data/") ``` ## Dense Layer ``` dfDense = pd.read_pickle(os.path.join(DATA_DIR,'%s/8/benchmark_dense__201...
github_jupyter
# Example 14: RVT SRA with multiple motions and simulated profiles Example with multiple input motions and simulated soil profiles. ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import pysra %matplotlib inline # Increased figure sizes plt.rcParams["figure.dpi"] = 120 ``` ## Create a po...
github_jupyter
``` import numpy as np import tensorflow as tf class HMM(object): def __init__(self, initial_prob, trans_prob, obs_prob): self.N = np.size(initial_prob) self.initial_prob = initial_prob self.trans_prob = trans_prob self.emission = obs_prob assert self.initial_prob.shape == (s...
github_jupyter
# Tanzania dataset presentation This notebook presents the [Open AI Tanzania dataset](https://blog.werobotics.org/2018/08/06/welcome-to-the-open-ai-tanzania-challenge/), released after a recent deep learning [challenge](https://competitions.codalab.org/competitions/20100), and used in this semantic segmentation projec...
github_jupyter
# MoViNet Tutorial This notebook provides basic example code to create, build, and run [MoViNets (Mobile Video Networks)](https://arxiv.org/pdf/2103.11511.pdf). Models use TF Keras and support inference in TF 1 and TF 2. Pretrained models are provided by [TensorFlow Hub](https://tfhub.dev/google/collections/movinet/),...
github_jupyter
# 函数定义 本章我们将介绍编程语言中非常重要的一个概念——函数。这里的函数和我们之前在数学中所学习的函数,有一些相似点,也有些不同。 相似点是,它们本质都是一段操作的复用。在数学里,假如我们有一个函数:$f(x)=3x+9$,当我们计算 $f(3)$ 或者 $f(9)$ 的时候,都是在进行 $3x+9$ 这个操作。在程序中呢,也是类似的,我们用几行代码定义了一个函数,每次调用这个函数就是重复那几段代码的操作。 不同的是,在数学的函数中,我们只能定义 $f(x,y) = x^2 + xy + 3$ 这样的函数,却不能定义 $f(x,y) = x^2 + ny + m$ 这样的函数,我们不知道这里面的 $m$ 和 $n$ 是什么...
github_jupyter
# WELCOME TO THE YOUTUBE SCRAPER USING BS4 Hello All, I will show you all how to scrape youtube and display the video in the Notebook itself. Also, we can store the details in the excel for further use. Before Scraping any website, go through their terms and conditional. You can find the code in github - https://gith...
github_jupyter
``` from transformers import DistilBertTokenizerFast, DistilBertForSequenceClassification,AdamW,BertForSequenceClassification,DistilBertModel import torch from torch.utils.data import DataLoader import pickle from sklearn.model_selection import train_test_split import numpy as np import tqdm import sys from sklearn.fea...
github_jupyter
[![img/pythonista.png](img/pythonista.png)](https://www.pythonista.io) # *URLs* y redireccionamiento. ## La función ```flask.url_for()```. La función ```flask.url_for()``` permite utilizar una función de vista como referencia en vez de su *URL* correspondiente con la siguiente sintaxis. ``` url_for(<función>, value...
github_jupyter
# Validate and prepare YAML policy stubs ``` import copy import pathlib import json import os import re import lxml.etree import networkx import pandas from pykwalify.core import ( Rule, Core as Kwalify, ) import ruamel.yaml ``` ## Configuration ``` schema_path = 'schema.yml' test_paths = list(map(str, path...
github_jupyter
``` from sklearn import neighbors, datasets iris = datasets.load_iris() X, y = iris.data, iris.target print ("data=", X, "\ntarget=",y); from sklearn.decomposition import PCA ''' Principal component analysis (PCA) Linear dimensionality reduction using Singular Value Decomposition of the data to project it to a lower...
github_jupyter
# Parallel Processing with Metakernel Metakernel uses the `ipyparallel` system for running code in parallel. This notebook demonstrates the process using the kernel Calysto Scheme. However, other Metakernel-based kernels may also work. The kernel needs to be able to return values, and implement kernel.set_variable() a...
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 sys sys.path.insert(0, '/home/emmanuel/code/py_iasi') sys.path.insert(0, '/home/emmanuel/papers_code/2019_egp_letter/src') # standard packages import numpy as np import xarray as xr import pandas as pd # IASI dataloader from pyiasi.iasi import IASIDataLoader, IASIData # GP Models from models.exact import ...
github_jupyter
<center><h1> CSS Playground </h1></center> A notebook that contain most of the things that could be displayed, to test CSS, feel free to add things to it, and send modification # Title first level ## Title second Level ### Title third level #### h4 ##### h5 ###### h6 # h1 ## h2 ### h3 #### h4 ##### h6 This is ...
github_jupyter
# Results Visualisation --- ``` import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from annex_new import import_ from annex_new import get_ellipticity from annex_new import get_bh_errors from annex_new import get_sep_errors from annex_new import get_elli_errors from annex_new import count_per_...
github_jupyter
``` import numpy as np import pandas as pd from collections import Counter import operator df = pd.read_csv("datasets/titanic_data.csv") df.head() from sklearn.model_selection import train_test_split train_data, test_data = train_test_split(df, test_size=0.33, random_state=42) train_data.info() ``` Okay, the **Age**,...
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
# A brief description of the proposed distribution They calculate different characteristics of the voxel values of images captured by different devices, and using statistical hypothesis testing they reject null hypothesizes by low values of p-values, and they conclude that the statistical distribution generating these...
github_jupyter
# k-NN Image Classifier This chapter aims to create a image classifier for a dataset consisting of images of dogs, cats and pandas. k-NN is the simplest machine learning algorithm. It works like this: In the training phase the images are put in a cartesian path, where the axes are the values of the feacture vectors, a...
github_jupyter
## Imports ``` import os, tarfile, sys from pathlib import Path from time import time from pprint import pprint from collections import Counter import numpy as np from numpy.random import choice import pandas as pd import spacy from gensim.models.word2vec import LineSentence from gensim.models.phrases import Phrase...
github_jupyter
``` # !wget https://raw.githubusercontent.com/NVIDIA/NeMo/main/examples/speaker_recognition/conf/SpeakerNet_recognition_3x2x512.yaml # !cat conf/SpeakerNet_recognition_3x2x512.yaml # !pip3 install nemo-toolkit[asr]==1.0.0b1 # !pip3 install torchaudio>=0.6.0 -f https://download.pytorch.org/whl/torch_stable.html # !git p...
github_jupyter
``` #default_exp cli ``` # CLI > Run the forecasting pipeline with configuration files ``` #export import pandas as pd import typer from mlforecast.api import ( _paste_dynamic, _path_as_str, _prefix_as_path, _read_dynamic, fcst_from_config, parse_config, perform_backtest, read_data, ...
github_jupyter