text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` %pylab inline ``` # Генерирование гауссовских случайных процессов ## 1. Генерирование с помощью многомерного нормального вектора Если вам нужно сгенерировать реализацию гауссовского случайного процесса $X = (X_t)_{t \geqslant 0}$ фиксированной известной (и не слишком большой) длины $n$, можно воспользоваться тем...
github_jupyter
``` import numpy as np import matplotlib %matplotlib inline import matplotlib.pyplot as plt import py21cmfast as p21c from py21cmfast import global_params from py21cmfast import plotting random_seed = 1605 EoR_colour = matplotlib.colors.LinearSegmentedColormap.from_list('mycmap',\ [(0, 'white'),(0.33,...
github_jupyter
# Maximising the utility of an Open Address Anthony Beck (GeoLytics), John Daniels (UU), Paul Williams (UU), Dave Pearson (UU), Matt Beare (Beare Essentials) ![](https://dl.dropboxusercontent.com/u/393477/ImageBank/ForAddresses/UU_SPA_CONCEPTUAL.png) Go down for licence and other metadata about this presentation ...
github_jupyter
This notebook was prepared by Marco Guajardo. Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Challenge Notebook ## Problem: Implement a binary search tree with insert, delete, different traversals & max/min node values * [Constraints](#Constraints) * [Test Case...
github_jupyter
``` import numpy as np import env import catalog as Cat import sham_hack as SHAM import observables as Obvs import AbundanceMatching as AM import corner as DFM import matplotlib as mpl import matplotlib.pyplot as plt mpl.rcParams['text.usetex'] = True mpl.rcParams['font.family'] = 'serif' mpl.rcParams['axes.linew...
github_jupyter
``` # 1 # Load The dataset import numpy data = numpy.loadtxt("./data/pima-indians-diabetes.csv", delimiter=",") X = data[:,0:8] y = data[:,8] # 2 # Create the function that returns the keras model from keras.models import Sequential from keras.layers import Dense from keras.regularizers import l2 def build_model(lambda...
github_jupyter
# Which is the fastest axis of an array? I'd like to know: which axes of a NumPy array are fastest to access? ``` import numpy as np %matplotlib inline import matplotlib.pyplot as plt ``` ## A tiny example ``` a = np.arange(9).reshape(3, 3) a ' '.join(str(i) for i in a.ravel(order='C')) ' '.join(str(i) for i in a....
github_jupyter
## Summary In this notebook we load a network trained to solve Sudoku puzzles and use this network to solve a single Sudoku. ---- ## Imports ``` import functools import io import os import sys import tempfile import time from collections import deque from pathlib import Path import ipywidgets as widgets import num...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline import os os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"; os.environ["CUDA_VISIBLE_DEVICES"]="0" import ktrain from ktrain import graph as gr ``` # Node Classification in Graphs In this notebook, we will use *ktrain* to perform node classificaiton on the Cora...
github_jupyter
# Gaussian Process Example 1 # The GP model is widely considered at the reference when doing ensemble modeling. This notebook can serve to test the behaviour of GP within the context of scikit learn. In theory, 1 GP should be "an ensemble" in it's own right...so comparison should be made to single GP instances. Basic ...
github_jupyter
<a href="https://colab.research.google.com/github/deepchatterjeevns/Pytorch-Udacity-Challenge/blob/master/intro-to-pytorch/Part%205%20-%20Inference%20and%20Validation%20(Exercises%20solved).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` import ...
github_jupyter
# Demonstration notebook for the Pulse of the City project. In this notebook, you will find examples of how to run the scripts and obtain results from the pedestrian traffic prediction, as well as the spatial interpolation and visualisation systems. ** Index: ** 1. [Part 1: Predicting pedestrian traffic](#Part-1:-Pre...
github_jupyter
## Estimating the coefficient of a regression model via scikit-learn ``` ''' loading the dataset ''' from data import load_data import numpy as np from sklearn.preprocessing import StandardScaler df = load_data() X = df[['RM']].values y = df['MEDV'].values sc_x = StandardScaler() sc_y = StandardScaler() X_std = sc_x....
github_jupyter
# San Diego Burrito Analytics: Linear models Scott Cole 21 May 2016 This notebook attempts to predict the overall rating of a burrito as a linear combination of its dimensions. Interpretation of these models is complicated by the significant correlations between dimensions (such as meat quality and non-meat filling ...
github_jupyter
## Scaling to Minimum and Maximum values - MinMaxScaling Minimum and maximum scaling squeezes the values between 0 and 1. It subtracts the minimum value from all the observations, and then divides it by the value range: X_scaled = (X - X.min / (X.max - X.min) ``` import pandas as pd # dataset for the demo from skle...
github_jupyter
# Land Use/Land Cover ``` import networkx as nx import osmnx as ox import pygeohydro as gh from pynhd import NLDI ``` Land cover, imperviousness, and canopy data can be retrieved from the [NLCD](https://www.mrlc.gov/data) database. First, we use [PyNHD](https://github.com/cheginit/pynhd) to get the contributing water...
github_jupyter
# Profiling OpenACC Code This lab is intended for C/C++ programmers. If you prefer to use Fortran, click [this link.](../Fortran/README.ipynb) You will receive a warning five minutes before the lab instance shuts down. At this point, make sure to save your work! If you are about to run out of time, please see the [Po...
github_jupyter
<a href="https://colab.research.google.com/github/ayulockin/Explore-NFNet/blob/main/Train_Basline_Cifar10.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> * This is the baseline notebook to setup training a ResNet20 model on Cifar10 dataset. * Hori...
github_jupyter
``` # %load defaults.ipy import numpy as np import matplotlib matplotlib.rcParams['savefig.dpi'] = 600 %matplotlib inline import matplotlib.pyplot as plt import sys sys.path.append('../python') from plot_info import showAndSave, savePlot, get_environment import plot_info plot_info.set_notebook_name("WassersteinDistanc...
github_jupyter
# Reshaping data: Portland housing developments In this notebook, we're going to work with some data on Portland (Oregon) housing developments since 2014. Right now, the data are scattered across a jillion spreadsheets. Our goal is to parse them all into one clean CSV. (Thanks to [Kelly Kenoyer of the Portland Mercury...
github_jupyter
# Composing Time Constructions In this notebook we build and test a Hebrew phrase parser. ``` import sys import collections import pickle import random import re import copy import numpy as np import networkx as nx from datetime import datetime import matplotlib.pyplot as plt from Levenshtein import distance as lev_d...
github_jupyter
# Sample testing for DEM & slopes This is basically a sandbox. By playing with smaller area, eg, a single tile of TMS zoom 10, we can get accurate comparison of approaches. * The `cut_extent` command will extract from an existing DEM. * The `slope` command converts to mbtile. See [gdal_slope_util.py](../src/gdal_slo...
github_jupyter
# 3D Frangi vesselness measure example ``` import numpy as np import pyqtgraph as pg from scipy import ndimage as ndi import matplotlib.pyplot as plt % matplotlib inline %gui qt import sys sys.path.append('..') if sys.version_info >= (3,0): print("Sorry, requires Python 2.x, not Python 3.x") import core.frangi as ...
github_jupyter
# Output part of infinite matter dataframe as LaTeX table This notebook generates Tables II and III in the Appendix of _Quantifying uncertainties and correlations in the nuclear-matter equation of state_ by [BUQEYE](https://buqeye.github.io/) members Christian Drischler, Jordan Melendez, Dick Furnstahl, and Daniel Phi...
github_jupyter
## Basic relationship plots Last time, we played around with plotting the distributions of variables, and comparing distributions to one another. Oftentimes, however two variables intimately related such that knowing a particular value of one variable allows you to predict, to some extent, the value of another variabl...
github_jupyter
# Table of Contents <p><div class="lev1"><a href="#Correlation-and-Causation"><span class="toc-item-num">1&nbsp;&nbsp;</span>Correlation and Causation</a></div><div class="lev1"><a href="#Mortality"><span class="toc-item-num">2&nbsp;&nbsp;</span>Mortality</a></div><div class="lev1"><a href="#Deciding"><span class="toc...
github_jupyter
Lambda School Data Science *Unit 2, Sprint 1, Module 4* --- # Logistic Regression - do train/validate/test split - begin with baselines for classification - express and explain the intuition and interpretation of Logistic Regression - use sklearn.linear_model.LogisticRegression to fit and interpret Logistic Regressi...
github_jupyter
``` %reload_ext autoreload %autoreload 2 %matplotlib inline from shingle import * from text import * import pandas as pd from sklearn.metrics import f1_score, accuracy_score from tqdm.notebook import tqdm import matplotlib.pyplot as plt import gc plt.style.use("ggplot") ``` # Utility Functions ``` def merge(texts): ...
github_jupyter
Following https://medium.com/technovators/machine-learning-based-multi-label-text-classification-9a0e17f88bb4 ``` import sys sys.path.append('/usr/local/lib/python3.9/site-packages') from sklearn.svm import LinearSVC from sklearn.multiclass import OneVsRestClassifier from sklearn.calibration import CalibratedClassifie...
github_jupyter
# Forecasting Air Passenger using Random Forest ``` import numpy as np import pandas as pd import os import warnings from copy import copy import pickle import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import mean_squared_err...
github_jupyter
https://twitter.com/yujitach/status/1424030835771023363 ``` VERSION ]st Threads.nthreads() """ Original * https://gist.github.com/yujitach/c30d7a174bbc3d3d3e40a3c0f9f9d47f * TAB を " " で置換 """ module Original using LinearAlgebra,LinearMaps import Arpack const L=20 diag_ = zeros(Float64,2^L) function pre...
github_jupyter
``` import os import zipfile import random import tensorflow as tf from tensorflow.keras.optimizers import RMSprop from tensorflow.keras.preprocessing.image import ImageDataGenerator from shutil import copyfile # If the URL doesn't work, visit https://www.microsoft.com/en-us/download/confirmation.aspx?id=54765 # And ri...
github_jupyter
# 18 - K Nearest Neighbors (KNN) - Theory - Here we will understand the K Nearest Neighbour Algorithm and how to use it for classification problems. ## Reading Assignment Chapter 4 : Introduction to Statistical Learning (ISLR) By Gareth James, et al. ## What is KNN ? - K Nearest Neighbors is a classification algor...
github_jupyter
``` from pyspark.conf import SparkConf from pyspark.sql import SparkSession from pyspark.sql.functions import * from pyspark.sql.types import BooleanType, IntegerType from datetime import * from settings import obtener_timestamp, obtener_dia_semana """ Configuramos Spark """ conf = SparkConf() conf.setAppName("Procesam...
github_jupyter
``` from traitlets.config.manager import BaseJSONConfigManager # To make this work, replace path with your own: # On the command line, type juypter --paths to see where your nbconfig is stored # Should be in the environment in which you install reveal.js # path = "/Users/jacobperricone/anaconda/envs/py36/bin/jupyter" #...
github_jupyter
``` from robotsearch.robots import rct_robot import numpy as np import os import pandas as pd ``` ## Prepping CoronaWhy dataset ``` coy_df = pd.read_csv('/media/axhue/WD/Data/Coronawhy/Annotationv2.csv') def clean_labels(labels): labels.rename(columns=labels.iloc[0,5:-1].to_dict(),inplace=True) labels.drop(0...
github_jupyter
## Looking Through Tree-Ring Data in the Southwestern USA Using Pandas **Pandas** provides a useful tool for the analysis of tabular data in Python, where previously we would have had to use lists of lists, or use R. ``` ## Bringing in necessary pckages %config InlineBackend.figure_format = 'svg' %matplotlib inline i...
github_jupyter
# Guide ## Quick-start Let's import our package and define two small lists that we would like to compare in similarity ``` from polyfuzz import PolyFuzz from_list = ["apple", "apples", "appl", "recal", "house", "similarity"] to_list = ["apple", "apples", "mouse"] ``` Then, we instantiate our PolyFuzz model and choo...
github_jupyter
# TV Script Generation In this project, you'll generate your own [Seinfeld](https://en.wikipedia.org/wiki/Seinfeld) TV scripts using RNNs. You'll be using part of the [Seinfeld dataset](https://www.kaggle.com/thec03u5/seinfeld-chronicles#scripts.csv) of scripts from 9 seasons. The Neural Network you'll build will ge...
github_jupyter
``` # hide # all_tutorial ! [ -e /content ] && pip install -Uqq mrl-pypi # upgrade mrl on colab ``` # Tutorial - RL Train Cycle Overview >Overview of the RL training cycle ## RL Train Cycle Overview The goal of this tutorial is to walk through the RL fit cycle to familiarize ourselves with the `Events` cycle and g...
github_jupyter
``` ## This script is used to read genomic data (in tabular format) from S3 and store features in SageMaker FeatureStore import boto3 import numpy as np import pandas as pd import matplotlib.pyplot as plt import io, os from time import gmtime, strftime, sleep import time import sagemaker from sagemaker.session import S...
github_jupyter
## Chemical kinetics In chemistry one is often interested in how fast a chemical process proceeds. Chemical reactions (when viewed as single events on a molecular scale) are probabilitic. However, most reactive systems of interest involve very large numbers of molecules (a few grams of a simple substance containts on t...
github_jupyter
# Combine datasets together ``` # Import libraries import os #operating system import glob # for reading multiple files from glob import glob import pandas as pd #pandas for dataframe management import matplotlib.pyplot as plt #matplotlib for plotting import matplotlib.dates as mdates # alias for date formatting impor...
github_jupyter
# Additional analyses for manuscript revisions This notebook contains additional analyses performed for a revised version of the manuscript. In particular, two analyses are performed: 1. Determining whether there is a bias in the linear arrangement of motifs in strong enhancers and silencers. 2. Associating differentia...
github_jupyter
# LAB: Introdução a Pandas 1 ## 1. Introdução Neste caso usaremos uma versão muito resumida dos dados do [Censo Demográfico (levantamento realizado pelo INDEC)](http://www.indec.gov.ar/bases-de-datos.asp). Trata-se de uma pesquisa contínua cujo objetivo principal é gerar informações sobre o funcionamento do mercado d...
github_jupyter
``` from google.colab import drive drive.mount('/content/gdrive') import os os.chdir('/content/gdrive/My Drive/finch/tensorflow2/text_classification/imdb/main') %tensorflow_version 2.x !pip install tensorflow-addons import tensorflow as tf import numpy as np import pprint import logging import time from tensorflow_add...
github_jupyter
# 一、数据预处理 ``` import pandas as pd df = pd.read_csv('../data/qualitydata_3/jmt0718withGeoLocation.csv') print df.shape print df.columns.values # print df.dtypes # print df.describe(include='all') df.head(10) # 把REGION和CITY字段为 NaN 的部分填充为 Unknown df.COUNTRY= df.COUNTRY.fillna('Unknown') df.REGION= df.REGION.fillna('...
github_jupyter
# Activity 5: Assembling a Deep Learning System In this activity, we will train the first version of our LSTM model using Bitcoin daily closing prices. These prices will be organized using the weeks of both 2016 and 2017. We do that because we are interested in predicting the prices of a week's worth of trading. ``` %...
github_jupyter
# Neural Sequence Distance Embeddings [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/gcorso/NeuroSEED/blob/master/tutorial/NeuroSEED.ipynb) The improvement of data-dependent heuristics and representation for biological sequences is a critical requ...
github_jupyter
## Python Generator 파이썬 제너레이터는 메모리를 효율적으로 사용하면서 반복을 수행하도록 돕는 객체입니다. 제너레이터가 무엇인지 감을 잡기 위해 먼저 다음과 같은 문제를 상상해보겠습니다. **문제: 특정한 길이의 숫자 배열이 주어졌을 때, 이를 제곱한 수들을 담은 배열을 출력하라** 이를 list를 활용하여 풀면 다음과 같이 풀 수 있습니다. ``` num_count = 10 nums = [i for i in range(num_count)] print(nums) def square_list(nums): result = [] fo...
github_jupyter
# Dano's CORVO & TPOT notebook In this notebook, I will try and use TPOT to asses what traditional ML algorithms would be useful to predict cognitive performance from EEG data in Neurodoro ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import sklearn as sk from os import walk from os impo...
github_jupyter
# Training and Serving with TensorFlow on Amazon SageMaker *(This notebook was tested with the \"Python 3 (Data Science)\" kernel.)* Amazon SageMaker is a fully-managed service that provides developers and data scientists with the ability to build, train, and deploy machine learning (ML) models quickly. Amazon SageMa...
github_jupyter
# Saving and Loading Models <a href="https://colab.research.google.com/github/jwangjie/gpytorch/blob/master/examples/00_Basic_Usage/Saving_and_Loading_Models.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> In this bite-sized notebook, we'll go over...
github_jupyter
# Demonstrate the Sankey class by producing three basic diagrams Code taken from the [Sankey API](http://matplotlib.org/api/sankey_api.html) at Matplotlib doc ``` %matplotlib inline import numpy as np import matplotlib.pyplot as plt from matplotlib.sankey import Sankey ``` ## Example 1 -- Mostly defaults This demo...
github_jupyter
# Amazon SageMaker Workshop ## _**Introduction**_ This workshop has been adapted from an [AWS blog post](https://aws.amazon.com/blogs/ai/predicting-customer-churn-with-amazon-machine-learning/). Losing customers is costly for any business. Identifying unhappy customers early on gives you a chance to offer them incen...
github_jupyter
# BOSS: Bag-of-SFA Symbols * Website: https://www2.informatik.hu-berlin.de/~schaefpa/boss/ * Paper: https://www2.informatik.hu-berlin.de/~schaefpa/boss.pdf **Note: an Internet connection is required to download the datasets used in this benchmark.** ``` import numpy as np from pyts.transformation import BOSS from p...
github_jupyter
## RetinaNet Keras-RetinaNet 모델 훈련 및 예측 과정입니다. [keras-retinanet](https://github.com/fizyr/keras-retinanet) 패키지가 필요합니다. - Tensorflow를 다운로드 및 설치합니다. 2.3.0 이후 버전이 필요합니다. ``` python -m pip install tensorflow ``` - Git 저장소에서 최신 패키지를 다운로드 및 설치합니다. ``` git clone https://github.com/fizyr/keras-retinanet.git cd keras-...
github_jupyter
``` # default_exp timeseries.data ``` # timeseries.data > API details. ``` #export from fastai.torch_basics import * from fastai.data.all import * from fastai.tabular.data import * from fastai.tabular.core import * from fastrenewables.tabular.core import * from fastrenewables.timeseries.core import * import glob #hi...
github_jupyter
# Real-world data analysis example: PPC Campaign Performance In the following example, we will load and analyze a generated set of data. The dataset is almost in the same format as could be obtained from AdWords using its reporting API, but the data itself is completely generated and any similarities with any existing...
github_jupyter
# High-level RNN TF Example ``` import numpy as np import os import sys import tensorflow as tf from common.params_lstm import * from common.utils import * # Force one-gpu os.environ["CUDA_VISIBLE_DEVICES"] = "0" print("OS: ", sys.platform) print("Python: ", sys.version) print("Numpy: ", np.__version__) print("Tensorf...
github_jupyter
``` !pip install gluoncv import boto3 from IPython.display import clear_output, Image, display, HTML import numpy as np import cv2 import base64 from bokeh.plotting import figure from bokeh.io import output_notebook, show, push_notebook import time import json output_notebook() STREAM_NAME = "pi4-001" kvs = boto3.clien...
github_jupyter
# Effect of the sample size in cross-validation In the previous notebook, we presented the general cross-validation framework and how to assess if a predictive model is underfiting, overfitting, or generalizing. Besides these aspects, it is also important to understand how the different errors are influenced by the nu...
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/jak...
github_jupyter
# Prerequisites Install the `OpenPAI` sdk from `github` and specify your cluster information in `~/.openpai/clusters.yaml`. And for simplicity and security, we recommand user to setup necessary information in `.openpai/defaults.json` other than shown in the example notebook. (Refer to for [README](https://github.com/...
github_jupyter
# Riemann Staircase A notebook to caclulate functions to visualise the prime staircase using Riemann's formula. ``` from mpmath import * from sympy import mobius import numpy as np import matplotlib.pyplot as plt from tqdm.notebook import trange mp.dps = 30; mp.pretty = True def Li(x, rho=1): return ei(rho * log(...
github_jupyter
# Foundations of Computational Economics #12 by Fedor Iskhakov, ANU <img src="_static/img/dag3logo.png" style="width:256px;"> ## Enumeration of discrete compositions <img src="_static/img/lab.png" style="width:64px;"> <img src="_static/img/youtube.png" style="width:65px;"> [https://youtu.be/eU2WRHBTFBw](https://y...
github_jupyter
**A high-level plotting API for the PyData ecosystem built on HoloViews.** <img src="./assets/diagram.png" width="70%"></img> The PyData ecosystem has a number of core Python data containers that allow users to work with a wide array of datatypes, including: * [Pandas](https://pandas.pydata.org): DataFrame, Series ...
github_jupyter
Face detection with OpenCV isn't something new or complicated. There is however the aspect of face recognition. Combining all of that plus some PIL image processing we can make a fun machine vision app. ``` import pytest import ipytest ipytest.autoconfig() ``` ### Detect faces, draw memes ``` import os import cv2 ...
github_jupyter
### Test create data func ``` !dvc pull ../data/observations_ad_0.0.pickle.dvc import sys sys.path.append('../src') import yaml import math import pickle import numpy as np from pickle_wrapper import unpickle, pickle_it import matplotlib.pyplot as plt from pickle_wrapper import unpickle, pickle_it from mcmc_norm_le...
github_jupyter
# datasets ``` import h5py import cupy as cp #加载数据的function def load_dataset(): train_dataset = h5py.File('../datasets/train_signs.h5', "r") train_set_x_orig = cp.array(train_dataset["train_set_x"][:]) # your train set features train_set_y_orig = cp.array(train_dataset["train_set_y"][:]) # your train set...
github_jupyter
### VQE(Variational quantum eigensolver) パラメータ付き量子回路で変分的に基底状態を求めましょう。 ### 必要なライブラリをインポート ``` from sympy import * from sympy.physics.quantum import * from sympy.physics.quantum.qubit import Qubit,QubitBra,measure_all,measure_partial from sympy.physics.quantum.gate import X,Y,Z,H,CNOT,SWAP,CPHASE,CGateS from sympy.phys...
github_jupyter
# load package and settings ``` import cv2 import sys import dlib import time import socket import struct import numpy as np import tensorflow as tf from win32api import GetSystemMetrics import win32gui from threading import Thread, Lock import multiprocessing as mp from config import get_config import pickle import ...
github_jupyter
**author**: lukethompson@gmail.com<br> **date**: 9 Oct 2017<br> **language**: Python 3.5<br> **license**: BSD3<br> ## physicochemical_pairplot.ipynb ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns; sns.set() from empcolors import get_empo_cat_color %matplotlib inline p...
github_jupyter
# Improving generalization with regularizers and constraints Neural networks usually have a very large number of parameters, which may lead to overfitting in many cases (especially when you do not have a large dataset). There's a large number of methods for regularization, and here we cover the most usual ones which a...
github_jupyter
## astropy.wcs Implements the FITS WCS standard and some commonly used distortion conventions. This tutorial will show how to create a WCS object from a FITS file and how to use it to transform coordinates. ``` import numpy as np %matplotlib inline from matplotlib import pyplot as plt import os from astropy.io import...
github_jupyter
# Stack This chapter will cover the basics of stack. Let's import the necessary libraries for our code to run. ``` import java.util.*; import java.io.*; ``` ## Section 1. The Basics of Stack A stack is a collection based on the principle of adding elements and retrieving them in the opposite order. - Last-In, Fir...
github_jupyter
``` import pandas as pd import os os.chdir('..') from sklearn.feature_extraction.text import CountVectorizer import pandas as pd import numpy as np import requests import matplotlib.pyplot as plt import seaborn as sns sns.set_style('whitegrid') %matplotlib inline url = "https://en.wikivoyage.org/w/api.php?format=json...
github_jupyter
``` import org.apache.spark.{SparkConf, SparkContext} import org.apache.spark.mllib.feature.HashingTF import org.apache.spark.mllib.regression.LabeledPoint import org.apache.spark.mllib.util.MLUtils import com.amazonaws.services.sagemaker.sparksdk.IAMRole import com.amazonaws.services.sagemaker.sparksdk.algorithms.XG...
github_jupyter
# Identify DOSTA Sensors with Missing Two-Point Calibrations During a review of the dissolved oxygen data, it was discovered that there was an error in how the instrument calibration coefficients were being applied. The two-point calibration values, supplied by the vendor if a multipoint calibration was not warranted,...
github_jupyter
# Logistic Regression Here is logistic regression to sats.csv. We have 3 collumns, exam 1 , exam 2 and if it's submitted. #### Initialize ``` import numpy as np import matplotlib.pyplot as plt import pandas as pd df=pd.read_csv("sats.csv") X=df.iloc[:,:-1].values y=df.iloc[:,-1].values df.head() df.describe() ``` #...
github_jupyter
<i>Copyright (c) Microsoft Corporation. All rights reserved.<br> Licensed under the MIT License.</i> <br> # Model Comparison for NCF Using the Neural Network Intelligence Toolkit This notebook shows how to use the **[Neural Network Intelligence](https://nni.readthedocs.io/en/latest/) toolkit (NNI)** for tuning hyperpa...
github_jupyter
## Adding the required Libraries ``` import numpy as np import pandas as pd pd.set_option('display.max_columns',None) import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.colors as colors import seaborn as sns import nltk from nltk.tokenize import sent_tokenize from nltk.corpus import words ...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np from struct import unpack from sklearn import cluster import datetime import hdbscan import seaborn as sns from sklearn.preprocessing import PowerTransformer, normalize, MinMaxScaler, StandardScaler from tsnecuda import TSNE from struct import pack from sklearn_ext...
github_jupyter
# 목차 ## 1. 데이터 분석에 앞서 (워밍업) 1-1. 분석의 목적 1-2. 요구 조건 정의 ## 2. 통계의 기초 2-1. 평균과 표준편차 2-1-1. 대표값 2-1-2. 모집단과 표본 2-1-3. Random Sampling 2-2. 기술통계 추론통계 2-2-1. 기술통계 2-2-2. 추론통계 2-3. EDA 2-3-1. Visualization 2-3-2. 중심극한정리 2-4. 점추정과 구간추정 2-...
github_jupyter
# Load data ``` %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt np.set_printoptions(precision=3, linewidth=120) import sys sys.path.append("..") from scem import ebm, stein, kernel, util, gen from scem.datasets import * import matplotlib.pyplot as plt from tqdm import notebook as ...
github_jupyter
<a href="https://colab.research.google.com/github/csaybar/EarthEngineMasterGIS/blob/master/module06/04_RUSLE.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> <!--COURSE_INFORMATION--> <img align="left" style="padding-right:10px;" src="https://user-im...
github_jupyter
## Cleaning up Data Sometimes data comes to us in a form that requires some cleaning before we can begin with further analyses. In this exercise we will explore some tools and strategies for that. We'll begin by reading in a modified version of the Ithaca climate dataset that we worked with previously. You should n...
github_jupyter
``` %load_ext autoreload %autoreload 2 import csv import itertools import os from dataclasses import dataclass from datetime import datetime import numpy as np import pandas as pd from func_timeout import FunctionTimedOut, func_timeout from sklearn.metrics import accuracy_score from sklearn.svm import LinearSVC from t...
github_jupyter
# Work with Data Data is the foundation on which machine learning models are built. Managing data centrally in the cloud, and making it accessible to teams of data scientists who are running experiments and training models on multiple workstations and compute targets is an important part of any professional data scien...
github_jupyter
# Import Packages ``` import os import numpy as np import matplotlib.pyplot as plt import quantities as pq import neo from neurotic._elephant_tools import CausalAlphaKernel, instantaneous_rate pq.markup.config.use_unicode = True # allow symbols like mu for micro in output pq.mN = pq.UnitQuantity('millinewton', pq.N/...
github_jupyter
# BERT: As one of Autoencoding Language Models ``` import os from google.colab import drive drive.mount('/content/drive') !pip install transformers !pip install tokenizers os.chdir("drive/My Drive/data/") os.listdir() import pandas as pd imdb_df = pd.read_csv("IMDB Dataset.csv") reviews = imdb_df.review.to_string(ind...
github_jupyter
``` import torch import torch.nn as nn from collections import OrderedDict import shutil import time import gzip import os import json import numpy as np from dpp_nets.utils.io import make_embd, make_tensor_dataset, load_tensor_dataset from dpp_nets.utils.io import data_iterator, load_embd from torch.autograd import Va...
github_jupyter
# Monitoring Data Drift Over time, models can become less effective at predicting accurately due to changing trends in feature data. This phenomenon is known as *data drift*, and it's important to monitor your machine learning solution to detect it so you can retrain your models if necessary. In this lab, you'll conf...
github_jupyter
``` # set tf 1.x for colab %tensorflow_version 1.x # setup only for running on google colab # ! shred -u setup_google_colab.py ! wget https://raw.githubusercontent.com/hse-aml/intro-to-dl/master/setup_google_colab.py -O setup_google_colab.py import setup_google_colab # please, uncomment the week you're working on # se...
github_jupyter
# Imports ``` import os, re, sys, pickle, datetime import itertools import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import pandas as pd from scipy import stats from sklearn import metrics from sklearn.metrics import confusion_matrix,f1_score from sklearn.model_selection...
github_jupyter
<div class="alert alert-block alert-info" style="margin-top: 20px"> <a href="http://cocl.us/NotebooksPython101"><img src = "https://ibm.box.com/shared/static/yfe6h4az47ktg2mm9h05wby2n7e8kei3.png" width = 750, align = "center"></a> <a href="https://www.bigdatauniversity.com"><img src = "https://ibm.box.com/shared/sta...
github_jupyter
# Template File The data is given in CSV form precisely as would be given in data files. For each table started by the cell magic `%%Table`, the table name follows immediately. ![Figure](data/template/template.svg) ``` from Frame2D import Frame2D theframe = Frame2D('Template') ``` # Input Data ## Nodes Table `no...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/tutorials/streamlit_notebooks/TEXT_FINDER_EN.ipynb) # **Find words/phrases in text us...
github_jupyter
# Genre recognition: experiment Goal: Conclusion: Observations: ## Hyper-parameters ### Parameter under test ``` Pname = 'lg' Pvalues = [1, 10, 100] # Regenerate the graph or the features at each iteration. regen_graph = False regen_features = True regen_baseline = False ``` ### Model parameters ``` p = {} # ...
github_jupyter
## Boulder Watershed Demo Process ATL03 data from the Boulder Watershed region and produce a customized ATL06 elevation dataset. ### What is demonstrated * The `icesat2.atl06p` API is used to perform a SlideRule parallel processing request of the Boulder Watershed region * The `matplotlib` and `cartopy` packages are...
github_jupyter