text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges). # Solution Notebook ## Problem: Return all subsets of a set. * [Constraints](#Constraints) * [Test Cases](#Test-Cases) * [Algorithm](#Alg...
github_jupyter
``` import warnings warnings.filterwarnings('ignore') ``` ### Read COMPAS data ``` import pandas as pd pd.set_option('display.max_columns', None) df = pd.read_csv('compas-scores-two-years.csv', index_col='id') df = df.reset_index(drop=True) len(df) df.head() df['age_cat'].value_counts() #overwrite age cat ...
github_jupyter
# 机器学习练习 2 - 逻辑回归 这个笔记包含了以Python为编程语言的Coursera上机器学习的第二次编程练习。请参考 [作业文件](ex2.pdf) 详细描述和方程。 在这一次练习中,我们将要实现逻辑回归并且应用到一个分类任务。我们还将通过将正则化加入训练算法,来提高算法的鲁棒性,并用更复杂的情形来测试它。 代码修改并注释:黄海广,haiguang2000@qq.com ## 逻辑回归 在训练的初始阶段,我们将要构建一个逻辑回归模型来预测,某个学生是否被大学录取。设想你是大学相关部分的管理者,想通过申请学生两次测试的评分,来决定他们是否被录取。现在你拥有之前申请学生的可以用于训练逻辑回归的训练样本集。对于每一个训练...
github_jupyter
# Day02_1_Classification_excercise05(XGB) <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#이진-분류기" data-toc-modified-id="이진-분류기-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>이진 분류기</a></span><ul class="toc-item"><li><span><a href="#설정" data-toc-modif...
github_jupyter
``` import eland as ed import pandas as pd import numpy as np import matplotlib.pyplot as plt # Fix console size for consistent test results from eland.conftest import * ``` # Online Retail Analysis ## Getting Started To get started, let's create an `eland.DataFrame` by reading a csv file. This creates and populate...
github_jupyter
``` import numpy as np from plot_utils import read_Noise2Seg_results, fraction_to_abs, cm2inch from matplotlib import pyplot as plt plt.rc('text', usetex=True) ``` # Flywing n10: AP scores on validation data ``` alpha0_5_n10 = read_Noise2Seg_results('alpha0.5', 'flywing_n10', measure='SEG', runs=[1,2,3,4,5], ...
github_jupyter
# 14 - Introduction to Deep Learning - MLP by [Alejandro Correa Bahnsen](albahnsen.com/) and [Jesus Solano](https://github.com/jesugome) version 1.6 June 2020 ## Part of the class [AdvancedMethodsDataAnalysisClass](https://github.com/albahnsen/AdvancedMethodsDataAnalysisClass/tree/master/notebooks) This noteboo...
github_jupyter
# Character level language model - Dinosaurus Island Welcome to Dinosaurus Island! 65 million years ago, dinosaurs existed, and in this assignment they are back. You are in charge of a special task. Leading biology researchers are creating new breeds of dinosaurs and bringing them to life on earth, and your job is to ...
github_jupyter
## Introduction to Data Science ## Data Science Template with Pandas and Scikit-Learn Based on [this](https://towardsdatascience.com/how-to-master-scikit-learn-for-data-science-c29214ec25b0) article and others _________________________ [Scikit-learn](https://scikit-learn.org/stable/) is one of many [scikits](https:...
github_jupyter
# Import dependencies and libraries ``` %matplotlib inline #Dependencies import pandas as pd from matplotlib import pyplot as plt import numpy as np from scipy import stats pd.set_option("display.float_format", lambda x:"%.2f" % x) ``` # Import and read CSVs ``` #Files to Load for THE YEAR 2020 public_school_path =...
github_jupyter
# Iris classification example Example usage of tengp package for classification, using Iris dataset. We are going to load the data using [sklearn](http://scikit-learn.org/stable/modules/generated/sklearn.datasets.load_iris.html) package. ``` %matplotlib inline from sklearn.datasets import load_iris X, y = load_iris...
github_jupyter
# A Visual Notebook to Using BERT for the First TIme.ipynb <img src="https://jalammar.github.io/images/distilBERT/bert-distilbert-sentence-classification.png" /> In this notebook, we will use pre-trained deep learning model to process some text. We will then use the output of that model to classify the text. The te...
github_jupyter
# Colab-latent-composition Original repo: [chail/latent-composition](https://github.com/chail/latent-composition) Original colab: [here](https://github.com/chail/latent-composition/blob/main/notebooks/finetune_and_edit.ipynb) My fork: [Colab-latent-composition](https://github.com/styler00dollar/Colab-latent-composit...
github_jupyter
# Classifying Fashion-MNIST Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9...
github_jupyter
# Initialise the libs ``` import numpy as np import pandas as pa import matplotlib.pyplot as plt from sklearn import linear_model ``` # load the data ``` dtype_dict = {'bathrooms':float, 'waterfront':int, 'sqft_above':int, 'sqft_living15':float, 'grade':int, 'yr_renovated':int, 'price':float, 'bedrooms...
github_jupyter
<a href="https://colab.research.google.com/github/pachterlab/GRNP_2020/blob/master/notebooks/helper_functions/preseqHelpers.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> **This notebook shows the code in preseqHelpers, which contains helper functi...
github_jupyter
# AWD-LSTM ``` %load_ext autoreload %autoreload 2 %matplotlib inline #export from exp.nb_12 import * ``` ## Data [Jump_to lesson 12 video](https://course.fast.ai/videos/?lesson=12&t=6317) ``` path = datasets.untar_data(datasets.URLs.IMDB) ``` We have to preprocess the data again to pickle it because if we try to ...
github_jupyter
# Session 0: Preliminaries with Python/Notebook <p class="lead"> Parag K. Mital<br /> <a href="https://www.kadenze.com/courses/creative-applications-of-deep-learning-with-tensorflow/info">Creative Applications of Deep Learning w/ Tensorflow</a><br /> <a href="https://www.kadenze.com/partners/kadenze-academy">Kadenze Ac...
github_jupyter
<a href="https://colab.research.google.com/github/ashablinski/Capstone/blob/master/Collaborative_Neural_Rec_Sys.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **NEURAL COLLABORATIVE RECOMMENDER SYSTEM FOR MOVIES** ![Neural Nets](https://i.imgur...
github_jupyter
``` # -*- coding:UTF-8 -*- # This is the simulation of our evolving RS model under the FIRST framework of our assumptions on edge weights. import math import numpy as np # import matplotlib as mpl # mpl.use('Agg') import matplotlib.pyplot as plt from sklearn import linear_model from scipy.stats import norm import confi...
github_jupyter
# BCycle Austin stations This notebook looks at the stations that make up the Austin BCycle network. For each station we have the following information: * `station_id`: A unique identifier for each of the station. Used to connect the `bikes.csv` time-varying table to the static `stations` table. * `name`: The name of...
github_jupyter
``` # This Python 3 environment comes with many helpful analytics libraries installed # It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python # For example, here's several helpful packages to load import numpy as np # linear algebra import pandas as pd# data processing, CSV file I/O ...
github_jupyter
## MIC Demo 2 - Parallelising multiple measurements As the first part of the demonstration 1 shows, obtaining a multivariate MIC measurement requires multiple runs of the MIC algorithm. This is because: - A multivariate measurement on $K$ variables is decomposed into a sum of $K$ univariate runs, where each variable ...
github_jupyter
``` %matplotlib inline import numpy as np import time import h5py import keras import pandas as pd import math import joblib import matplotlib.pyplot as plt from fuel.datasets.hdf5 import H5PYDataset from sklearn.decomposition import PCA from sklearn.svm import SVC from sklearn.metrics import accuracy_score from skle...
github_jupyter
This is a companion notebook for the book [Deep Learning with Python, Second Edition](https://www.manning.com/books/deep-learning-with-python-second-edition?a_aid=keras&a_bid=76564dff). For readability, it only contains runnable code blocks and section titles, and omits everything else in the book: text paragraphs, fig...
github_jupyter
# AU Fundamentals of Python Programming-Module2Problems (Part. A) ## M2-Q02 '*'三角形 (時間限制:2 秒) 問題描述: 讓使用者輸入一正整數 n,利用迴圈以字元 '*' 輸出高度為 n 的三角形。 輸入說明: 輸入一正整數 n。 輸出說明: 利用迴圈以字元 '*' 輸出高度為 n 的三角形,最後必須有換行字元。 | Sample Input: | Sample Output: | |:----------------|:-------------------------| |4 | \* | | |...
github_jupyter
# Scikit-downscale: an open source Python package for scalable climate downscaling Joseph Hamman (jhamman@ucar.edu) and Julia Kent (jkent@ucar.edu) NCAR, Boulder, CO, USA ------- This notebook was developed for the [2020 EarthCube All Hands Meeting](https://www.earthcube.org/EC2020). The development of Scikit-downs...
github_jupyter
... ***CURRENTLY UNDER DEVELOPMENT*** ... ## Validation of the synthetic waves and level inputs required: * historical wave conditions * emulator output - synthetic wave conditions in this notebook: * Validation of the extreme distributions * Analysis of the DWT resposible of extreme TWL events (from the...
github_jupyter
``` import pandas as pd import re # load dataset from sample import read_csv_data data = read_csv_data(pd.read_csv('../dataset/ieee_xai.csv')) # load domain terms with open('../dataset/domain_terms.txt','r', encoding = 'utf-8') as f: domain_list = [i.strip().lower() for i in f.readlines()] ``` # Unsupervised Keyp...
github_jupyter
Центр непрерывного образования # Программа «Python для автоматизации и анализа данных» Неделя 3 - 1 *Ян Пиле, НИУ ВШЭ* ## Задачи ### Задача 1 Дана строка, состоящая из слов. Сделать из нее аббревиатуру с помощью списковых включений **Вход:** "Комитет Государственной Безопасности" **Выход:** "КГБ" ``` text = "К...
github_jupyter
Read the dataset ``` import pandas as pd df = pd.read_csv('b.csv') ``` Clean the data ``` categoryCol=['substrict','type','direction'] for i in categoryCol: df[i]=df[i].astype("category") df['time'] = pd.to_datetime(df['time'], format='%Y.%m.%d') for i in range(len(df)): if df.loc[i,'time'] < pd.Timestamp(...
github_jupyter
<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title"><b>Python in a Nutshell</b></span> was started by <a xmlns:cc...
github_jupyter
``` # Useful for debugging %load_ext autoreload %autoreload 2 ``` # xopt CNSGA2 function example Experimental, using `pymoo` as a backend. This has to be installed via: `pip install pymoo` ``` from xopt.cmoo import cnsga2 import json import numpy as np import matplotlib.pyplot as plt from time import sleep # All...
github_jupyter
### **Import Google Drive** ``` from google.colab import drive drive.mount('/content/drive') ``` ### **Import Library** ``` import glob import numpy as np import os import shutil np.random.seed(42) from sklearn.preprocessing import LabelEncoder import cv2 import tensorflow as tf import keras import shutil import ran...
github_jupyter
``` import os import json import numpy as np import pandas as pd import networkx as nx from pprint import pprint from datetime import datetime from collections import Counter ``` ### Data Retrieval Functions ``` # read in comment dictionary def get_comment_dictionary(body=False): # read in comment dictionary fro...
github_jupyter
# <font color='brown'>**SMS SPAM DETECTION**</font> ### **Installation** ``` import sys sys.path.append('../../') ``` ### **Load SMS Dataset** The SMS Spam Collection is a set of SMS tagged messages that have been collected for SMS Spam research. It contains one set of SMS messages in English of 5,574 messages, tag...
github_jupyter
![](../images/rivacon_frontmark_combined_header.png) # Interest Rate Swap ``` import pyvacon import pyvacon.analytics as analytics import datetime as dt import pyvacon.tools.converter as converter import pyvacon.marketdata.testdata as mkt_testdata import pyvacon.marketdata.plot as mkt_plot import pyvacon.tools.enums ...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../../landlab_header.png"></a> # Mapping values between grid elements <hr> <small>For more Landlab tutorials, click here: <a href="https://landlab.readthedocs.io/en/latest/user_guide/tutorials.html">https://landlab.readthedocs.io/en/latest/user_guide/tu...
github_jupyter
# Meteo data at Gotland This notebook preprocess the meteo data at Gotland and convert the data from the netCDF format to the GOTM input format. ``` import sys import os import numpy as np import xarray as xr import pandas as pd sys.path.append("../gotmtool") from gotmtool import * ``` ## Preprocess data ``` dataro...
github_jupyter
# Route Plan Analysis Use this notebook to map and analyze a routing plan from Azavea's [School Bus Routing Optimization tool](https://github.com/azavea/bus-plan). Update the cell below to point to local copies of solver output. ``` import os import plan_analysis as pa import drive_distances as dr %matplotlib inlin...
github_jupyter
# Masked Token Prediction with Vision We will make a quick check for the five converted models using the masked token prediction. ``` import torch import numpy as np import PIL.Image from eval_vl_glue import VoltaImageFeature from eval_vl_glue.extractor import BUTDDetector from eval_vl_glue import transformers_volta ...
github_jupyter
``` %matplotlib inline ``` # Compare the effect of different scalers on data with outliers Feature 0 (median income in a block) and feature 5 (number of households) of the `California housing dataset <http://www.dcc.fc.up.pt/~ltorgo/Regression/cal_housing.html>`_ have very different scales and contain some very lar...
github_jupyter
<figure> <IMG SRC="https://raw.githubusercontent.com/mbakker7/exploratory_computing_with_python/master/tudelft_logo.png" WIDTH=250 ALIGN="right"> </figure> # Exploratory Computing with Python *Developed by Mark Bakker* ## Notebook 12: Object oriented programming In this Notebook, we learn what Object Oriented Progr...
github_jupyter
``` import csv import contextlib import os, errno from collections import OrderedDict, Counter from IPython.core.display import display, HTML from pandas import DataFrame import pandas as pd import numpy as np from periodo_reconciler import ( RProperty, RQuery, PeriodoReconciler, CsvReconciler ) def ...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Deep Learning ## Project: Build a Traffic Sign Recognition Classifier In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is required that cannot be included i...
github_jupyter
# Simulating capillary pressure curves using Porosimetry Start by importing OpenPNM. ``` import numpy as np import openpnm as op np.random.seed(10) ws = op.Workspace() ws.settings["loglevel"] = 40 np.set_printoptions(precision=5) ``` Next, create a simple cubic network with 20 pores per side and a spacing of 50 um ...
github_jupyter
``` import os import sys # Modify the path sys.path.append("..") import pandas as pd import yellowbrick as yb import matplotlib.pyplot as plt from yellowbrick.classifier import ROCAUC from sklearn.model_selection import train_test_split import numpy as np from yellowbrick.exceptions import ModelError from yellow...
github_jupyter
# Name Submitting a Cloud Machine Learning Engine training job as a pipeline step # Label GCP, Cloud ML Engine, Machine Learning, pipeline, component, Kubeflow, Kubeflow Pipeline # Summary A Kubeflow Pipeline component to submit a Cloud ML Engine training job as a step in a pipeline. # Details ## Intended use Use th...
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
``` %load_ext autoreload %autoreload 2 ``` # Quick Guide Import the MolSysMT to start working: ``` import molsysmt as msm ``` ## Converting molecular systems ``` molecular_system = 'mmtf:1M2Z' molecular_system = msm.convert(molecular_system, to_form='1M2Z.mmtf') msm.get_form(molecular_system) molecular_system = ms...
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
# Линейная регрессия и основные библиотеки Python для анализа данных и научных вычислений Это задание посвящено линейной регрессии. На примере прогнозирования роста человека по его весу Вы увидите, какая математика за этим стоит, а заодно познакомитесь с основными библиотеками Python, необходимыми для дальнейшего прох...
github_jupyter
# Variational API quickstart The variational inference (VI) API is focused on approximating posterior distributions for Bayesian models. Common use cases to which this module can be applied include: * Sampling from model posterior and computing arbitrary expressions * Conduct Monte Carlo approximation of expectation,...
github_jupyter
``` from pathlib import Path import copy import matplotlib.pyplot as plt import numpy as np import torch import torchvision from torch.utils.data import DataLoader, Dataset, random_split from torchvision import transforms from torchvision.datasets import ImageFolder # GPUのセットアップ device = torch.device("cuda" if torch...
github_jupyter
## Numerical computation using Numpy ### The Newton Raphson root finding method Find the square root of 7 by numerically solving the equation: $x^2 - 7 = 0$ Let's assume that there is a function, $f(x) = x^2 - 7$ Now, we need to find the roots of this function $f(x)$, that is the values of $x : f(x) = 0$, which wil...
github_jupyter
``` import os import sys sys.path.append(os.path.expanduser('~/code/loggingbot')) from loggingbot import TelegramBotHandler ``` Telegram bot token (take it from [@botfather](https://telegram.me/botfather) ) and list of user ids where to send the messages are defined below. Note that this users should first start co...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=2 import tensorflow as tf gpu_devices = tf.config.experimental.list_physical_devices('GPU') if len(gpu_devices)>0: tf.config.experimental.set_memory_growth(gpu_devices[0], Tr...
github_jupyter
# Facial Keypoint Detection The objective of this task is to predict keypoint positions on face images. This can be used as a building block in several applications, such as: - tracking faces in images and video - analysing facial expressions - detecting dysmorphic facial signs for medical diagnosis -...
github_jupyter
``` ## NLP library import re import string import nltk from nltk.corpus import stopwords ## ML Library from sklearn.feature_extraction.text import CountVectorizer,TfidfVectorizer, TfidfTransformer from sklearn.model_selection import RepeatedStratifiedKFold,cross_val_score from sklearn.linear_model import LogisticRegre...
github_jupyter
# Continuous Training with AutoML Vertex Pipelines **Learning Objectives:** 1. Learn how to use Vertex AutoML pre-built components 1. Learn how to build a Vertex AutoML pipeline with these components using BigQuery as a data source 1. Learn how to compile, upload, and run the Vertex AutoML pipeline In this lab, you ...
github_jupyter
# Part 2 - Plotting photon energy spectra in a histogram form This example creates a simple sphere of tungsten and tallies the photons in two different ways: - Photon flux averaged across the cell - Photon current on the rear surface This section creates a simple material, geometry and settings. This model is used i...
github_jupyter
# EventVestor: Issue Equity In this notebook, we'll take a look at EventVestor's *Issue Equity* dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans January 01, 2007 through the current day, and documents events and announcements covering secondary equity issues by compani...
github_jupyter
# Customer Churn Prediction with XGBoost _**Using Gradient Boosted Trees to Predict Mobile Customer Departure**_ --- --- ## Contents 1. [Background](#Background) 1. [Setup](#Setup) 1. [Data](#Data) 1. [Train](#Train) 1. [Host](#Host) 1. [Evaluate](#Evaluate) 1. [Relative cost of errors](#Relative-cost-of-errors...
github_jupyter
# Visualisation de la précision dense vs sparse ``` import pandas as pd ``` On visualise ici les différentes performances selon le type de retriever choisi (sparse / dense). <br> Dans le notebook *Visualisation results* (results de Pavel) on visualisait la performance pour chaque test, ici on visualise plutot la *per...
github_jupyter
## Dependencies ``` !pip install --quiet efficientnet import warnings, time from kaggle_datasets import KaggleDatasets from sklearn.model_selection import KFold from sklearn.metrics import classification_report, confusion_matrix, accuracy_score from tensorflow.keras import optimizers, Sequential, losses, metrics, Mode...
github_jupyter
![QuantConnect Logo](https://cdn.quantconnect.com/web/i/qc_notebook_logo_rev0.png) ## Welcome to The QuantConnect Research Page #### Refer to this page for documentation https://www.quantconnect.com/docs/research/overview# #### Contribute to this template file https://github.com/QuantConnect/Lean/blob/master/Research/K...
github_jupyter
``` import sys sys.path.append(r'C:\Users\moallemie\EMAworkbench-master') sys.path.append(r'C:\Users\moallemie\EM_analysis') import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from ema_workbench import load_results, ema_logging from ema_workbench.em_framework.salib_samplers imp...
github_jupyter
# CATE estimators example ``` import pyspark.sql.functions as F import pysparkling import h2o from h2o.estimators.glm import H2OGeneralizedLinearEstimator %matplotlib inline import seaborn as sns import matplotlib.pyplot as plt from upliftml.models.h2o import ( SLearnerEstimator, TLearnerEstimator, CVTEs...
github_jupyter
# Training Mutual Information Maximization (MI-Max) RL algorithms in Brax In [Brax Training](https://colab.research.google.com/github/google/brax/blob/main/notebooks/training.ipynb) we tried out [gym](https://gym.openai.com/)-like environments and PPO, SAC, evolutionary search, and trajectory optimization algorithms. ...
github_jupyter
Scikit-learn comes with a few standard datasets, for instance the [iris](https://en.wikipedia.org/wiki/Iris_flower_data_set) and [digits](http://archive.ics.uci.edu/ml/datasets/Pen-Based+Recognition+of+Handwritten+Digits) datasets for classification and the [boston house prices](http://archive.ics.uci.edu/ml/datasets/H...
github_jupyter
<a href="https://colab.research.google.com/github/mrdbourke/tensorflow-deep-learning/blob/main/08_introduction_to_nlp_in_tensorflow.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Natural Language Processing Basics in TensorFlow ![](https://raw.g...
github_jupyter
# Enabling App Insights for Services in Production With this notebook, you can learn how to enable App Insights for standard service monitoring, plus, we provide examples for doing custom logging within a scoring files in a model. ## What does Application Insights monitor? It monitors request rates, response times, f...
github_jupyter
# 3 - Semi-variance Estimators This tutorial focuses on experimental variograms. It will guide you through the main semi-variance estimators available in `scikit-gstat`. Additionally, most of the parameters available for building an experimental variogram will be discussed. **In this tutorial you will learn:** * wha...
github_jupyter
# Summary: This notebook contains the soft smoothing figures for Haverford(Figure 2(d)). ## load libraries ``` from __future__ import division import networkx as nx import numpy as np import os from sklearn import metrics from sklearn.preprocessing import label_binarize from sklearn.metrics import confusion_matrix...
github_jupyter
``` """ Bouncing particles, refactored Srayan Gangopadhyay 2020-06-17 """ import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import matplotlib.animation as animation from IPython.display import HTML, display # show anim. in ntbk from tabulate import tabulate # pretty text outp...
github_jupyter
# Inspecting training data ## Background Prior to training a machine learning classifier, it can be useful to understand which of our feature layers are most useful for distinguishing between classes. The feature layers the models are trained on form the **knowledge base** of the algorithm. We can explore this knowle...
github_jupyter
![data-x](http://oi64.tinypic.com/o858n4.jpg) ## Introduction to Data-X Mostly basics about Python and Jupyter Notebooks #### Authors: Alexander Fred Ojala & Ikhlaq Sidhu **License Agreement:** Feel free to do whatever you want with this code Hi and welcome let's start --- # Valuable Resources 1. Installation of...
github_jupyter
# Interactive Data Exploration, Analysis, and Reporting (IDEAR) in Python for Azure Notebooks - Author: Team Data Science Process Team from Microsoft - Date: 2017/03 - Supported Data Sources: CSV files in Azure blob storage This is the **Interactive Data Exploration, Analysis and Reporting (IDEAR)** in _**Python**_ ...
github_jupyter
# Influence Measures for GLM Logit Based on draft version for GLMInfluence, which will also apply to discrete Logit, Probit and Poisson, and eventually be extended to cover most models outside of time series analysis. The example for logistic regression was used by Pregibon (1981) "Logistic Regression diagnostics" a...
github_jupyter
# Neural Spline Flow ``` # Import required packages import torch import numpy as np import normflow as nf from sklearn.datasets import make_moons from matplotlib import pyplot as plt from tqdm import tqdm # Set up model # Define flows K = 16 torch.manual_seed(0) latent_size = 2 hidden_units = 128 hidden_layers = ...
github_jupyter
``` #!pip install meteomatics import pandas as pd import meteomatics.api as api import datetime as dt ``` #### Stationslexikon DWD: https://www.dwd.de/DE/leistungen/klimadatendeutschland/statliste/statlex_html.html?view=nasPublication&nn=16102 ## Download weather forecast with Meteomatics API Set weather parameters ...
github_jupyter
# Reddit Flair Detector --- Note: You can jump straight to the best model - [CNN](#Multichannel-Convolutional-Neural-Network) (93% test-accuracy) ## Part III - Building a Flair Detector ### 1) Import required modules ``` import nltk import string import os import re import pandas as pd import numpy as np import te...
github_jupyter
## Coding Matrices Here are a few exercises to get you started with coding matrices. The exercises start off with vectors and then get more challenging ### Vectors ``` ### Assign the vector <5, 10, 2, 6, 1> to the variable v v = [5,10,2,6,1] ``` The v variable contains a Python list. This list could also be thought...
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
## Imports ``` import os import sys %env CUDA_VISIBLE_DEVICES=1 %matplotlib inline import re import time as ti import numpy as np import pprint import matplotlib.pyplot as plt import tensorflow as tf ...
github_jupyter
``` import spacy import wmd from utils.ArticlesHandler import ArticlesHandler from utils import Config from utils import knn_similarities, solve, get_rate, accuracy, precision, recall, f1_score import numpy as np nlp = spacy.load('en_core_web_md') config = Config(file='config') articles = ArticlesHandler(config) arti...
github_jupyter
# Guided Hunting - Base64-Encoded Linux Commands <details> <summary>&nbsp;<u>Details...</u></summary> **Notebook Version:** 1.0<br> **Python Version:** Python 3.6 (including Python 3.6 - AzureML)<br> **Required Packages**: kqlmagic, msticpy, pandas, pandas_bokeh, numpy, matplotlib, networkx, seaborn, datetim...
github_jupyter
# [A Regret Minimization Approach to Iterative Learning Control](https://arxiv.org/pdf/2102.13478.pdf ) ``` %load_ext autoreload %autoreload 2 import jax import jax.numpy as jnp from deluca.igpc.ilqr import iLQR from deluca.envs import PlanarQuadrotor ``` ### System - Planar Quadrotor with wind ([deluca implementatio...
github_jupyter
# Part 2: Launch an OpenGrid Node On Heroku OpenGrid (or "Grid") is the platform library supporting the deployment of libraries for privacy-preserving artificial intelligence. In this tutorial, you'll learn how to deploy a grid node onto Heroku and then interact with it using PySyft. _WARNING: Grid nodes publish data...
github_jupyter
# Single-step pipeline examples In this example, we'll build a very simple pipeline that just contains a single train step. The dataset and compute cluster created in this tutorial will be re-used in the subsequent examples in this module. ``` !pip install azureml-sdk --upgrade import os import azureml.core from azur...
github_jupyter
# K Means Clustering Project ___ It is **very important to note, we actually have the labels for this data set, but we will NOT use them for the KMeans clustering algorithm, since that is an unsupervised learning algorithm.** When using the Kmeans algorithm under normal circumstances, it is because you don't have l...
github_jupyter
``` # Copyright 2019 NVIDIA Corporation. All Rights Reserved. # # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
github_jupyter
# Registering Datasets and Layers into the API - All Aqueduct Water Risk Atlas datasets: https://staging-api.globalforestwatch.org/v1/dataset?application=aqueduct-water-risk&status=saved&page[size]=1000 - All Aqueduct Water Risk Atlas layers: https://staging-api.globalforestwatch.org/v1/layer?application=aqueduct-wat...
github_jupyter
``` %tensorflow_version 1.x import numpy as np import tensorflow as tf import keras from keras.layers import Dense,Conv2D,Conv2DTranspose,Input,Reshape,Activation,Lambda from keras.layers.advanced_activations import LeakyReLU from keras.optimizers import Adam from keras.layers import BatchNormalization,Dropout,Flatten ...
github_jupyter
# Exploring your harvested data In this notebook we'll look at some ways of exploring the `results.csv` created by the Trove Newspaper and Gazette Harvester. ``` import os import pandas as pd import altair as alt from wordcloud import WordCloud import zipfile from pathlib import Path from textblob import TextBlob fro...
github_jupyter
``` import pandas as pd import numpy as np from datetime import datetime, timedelta import math import os ``` ### This is the script for saving all coordinates as my own database. By doing so, `opencage.geocoder` does not need to go through all regions everytime (as most regions are already have coordinates in this d...
github_jupyter
# CS224N Assignment 1: Exploring Word Vectors (25 Points) Welcome to CS224n! Before you start, make sure you read the README.txt in the same directory as this notebook. ``` # All Import Statements Defined Here # Note: Do not add to this list. # All the dependencies you need, can be installed by running . # --------...
github_jupyter
# Anchor Boxes Object detection algorithms usually sample a large number of regions in the input image, determine whether these regions contain objects of interest, and adjust the edges of the regions so as to predict the ground-truth bounding box of the target more accurately. Different models may use different regio...
github_jupyter
# Quantum Generative Adversarial Networks ## Introduction Generative [adversarial](gloss:adversarial) networks (GANs) [[1]](https://arxiv.org/abs/1406.2661) have swiftly risen to prominence as one of the most widely-adopted methods for unsupervised learning, with showcased abilities in photo-realistic image generatio...
github_jupyter
``` from io import StringIO import numpy as np import pandas as pd import seaborn as sns cd /mnt/data_sm/olga/kmer-hashing/quest-for-orthologs/data/2019/ ll cat README ``` # Make Species dataframe ``` s = '''Proteome_ID Tax_ID OSCODE #(1) #(2) #(3) Species Name UP000007062 7165 ANOGA 12553 97...
github_jupyter