text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
``` import sys # for automation and parallelisation manual, scenario = (True, 'base') if 'ipykernel' in sys.argv[0] else (False, sys.argv[1]) if manual: %matplotlib inline import numpy as np import pandas as pd from quetzal.model import stepmodel ``` # Modelling steps 1 and 2. ## Saves transport demand between zon...
github_jupyter
# Identifying country names from incomplete house addresses <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"> <ul class="toc-item"> <li><span><a href="#Introduction" data-toc-modified-id="Introduction-1">Introduction</a></span></li> <li><span><a href="#Prerequisites" data-toc-modified-id="Prere...
github_jupyter
``` import os, sys os.getcwd() #!pip install azure-storage-blob --user #!pip install storefact --user import os, sys import configparser sys.path.append('/home/jovyan/.local/lib/python3.6/site-packages/') print(sys.path) os.path.abspath("AzureDownload/config.txt") os.getcwd() config = configparser.ConfigParser() confi...
github_jupyter
In the [previous part](http://earthpy.org/pandas-basics.html) we looked at very basic ways of work with pandas. Here I am going to introduce couple of more advance tricks. We will use very powerful pandas IO capabilities to create time series directly from the text file, try to create seasonal means with *resample* and...
github_jupyter
# Semantic querying of earth observation data Semantique (to be pronounced with sophisticated French accent) is a structured framework for semantic querying of earth observation data. The core of a semantic query is the **query recipe**. It contains instructions that together formulate a recipe for inference of new k...
github_jupyter
# Customize a TabNet Model ## This tutorial gives examples on how to easily customize a TabNet Model ### 1 - Customizing your learning rate scheduler Almost all classical pytroch schedulers are now easy to integrate with pytorch-tabnet ### 2 - Use your own loss function It's really easy to use any pytorch loss fun...
github_jupyter
# ANDES Demonstration of `DGPRCTExt` on IEEE 14-Bus System Prepared by Jinning Wang. Last revised 12 September 2021. ## Background Voltage signal is set manually to demonstrate `DGPRCTExt`. In the modified IEEE 14-bus system, 10 `PVD1` are conencted to `Bus4`, and 1 `DGPRCTExt` is added aiming at `PVD1_2`. ## Conc...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import sklearn as sk from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import MinMaxScaler # Набор данных взят с https://www.kaggle.com/aashi20/top-50-spotify-songs # Top-50 песен в Spotify в 2019 году. data = pd.read_c...
github_jupyter
# CH. 7 - TOPIC MODELS ## Activities #### Activity 1 ``` # not necessary # added to suppress warnings coming from pyLDAvis import warnings warnings.filterwarnings('ignore') import langdetect # language detection import matplotlib.pyplot # plotting import nltk # natural language processing import numpy # arrays a...
github_jupyter
# `pymdptoolbox` demo ``` import warnings from mdptoolbox import mdp import numpy as np import scipy as sp import matplotlib.pyplot as plt ``` ## The problem * You have a 20-sided die, and you get to roll repeatedly until the sum of your rolls either gets as close as possible to 21 or you bust. * Your score is the n...
github_jupyter
<p style = "font-size : 50px; color : #532e1c ; font-family : 'Comic Sans MS'; text-align : center; background-color : #bedcfa; border-radius: 5px 5px;"><strong>Titanic EDA and Prediction</strong></p> <img style="float: center; border:5px solid #ffb037; width:100%" src = https://sn56.scholastic.com/content/dam/classr...
github_jupyter
# Find Pairwise Interactions This notebook demonstrates how to calculate pairwise intra- and inter-molecular interactions at specified levels of granularity within biological assemblies and asymmetric units. ``` from pyspark.sql import SparkSession from mmtfPyspark.io import mmtfReader from mmtfPyspark.utils import Co...
github_jupyter
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/real-itu/modern-ai-course/blob/master/lecture-02/lab.ipynb) # Lab 2 - Adversarial Search [Connect 4](https://en.wikipedia.org/wiki/Connect_Four) is a classic board game in which 2 players alternate pl...
github_jupyter
# Building deep retrieval models **Learning Objectives** 1. Converting raw input examples into feature embeddings. 2. Splitting the data into a training set and a testing set. 3. Configuring the deeper model with losses and metrics. ## Introduction In [the featurization tutorial](https://www.tensorflow.org/recom...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('../') import wtools #%matplotlib notebook # Make the random numbers predictable for testing np.random.seed(0) ``` # Making Gridded/Mesh Data ## A simple case First, create a dictionary of your model data. For this example, we create a ...
github_jupyter
# 9. Archivos ## 9.1 ¿Qué es un archivo? Un archivo es un contenedor de información. En un archivo la información se almacena como un conjunto de bytes consecutivos. En el interior del archivo, la información se organiza acorde a un formato concreto (texto, binario, executable, etc.). Los archivos se representan com...
github_jupyter
<img src="../../../images/qiskit_header.png" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" align="middle"> ## Purity Randomized Benchmarking - Last Updated: July 25, 2019 - Requires: qiskit-terra 0.9, qiskit-ignis 0.2, qiskit-aer 0.3 ## Introduction ...
github_jupyter
``` import cv2 import numpy as np import dlib from tkinter import * import time from PIL import Image, ImageTk cap = cv2.VideoCapture(0) ret,frame=cap.read() detector = dlib.get_frontal_face_detector() count =0 marks =0 root = Tk() root.geometry("975x585") root.title("Exam Cheating Identifier v1.1") root.iconbitmap('...
github_jupyter
# KNeighborsClassifier with MaxAbsScaler This Code template is for the Classification task using a simple KNeighborsClassifier based on the K-Nearest Neighbors algorithm using MaxAbsScaler technique. ### Required Packages ``` !pip install imblearn import warnings import numpy as np import pandas as pd import seab...
github_jupyter
# Load data and libraries ``` from google.colab import drive drive.mount('/content/drive') !pip install shap !pip install pyitlib import os os.path.abspath(os.getcwd()) os.chdir('/content/drive/My Drive/Protein project') os.path.abspath(os.getcwd()) from __future__ import division ###for float operation from collecti...
github_jupyter
# Connect 4 sur un SenseHat --- ## Introduction ### Règles du Jeu Le Connect 4, Four in a Row, ou Puissance 4 en français est un jeu se déroulant sur une grille de 6 rangées et 7 colonnes. En insérant tour à tour un jeton coloré dans la dernière rangée, qui tombe ensuite dans le plus bas emplacement disponible, les ...
github_jupyter
# Text classification with Reuters-21578 datasets ### See: https://kdd.ics.uci.edu/databases/reuters21578/README.txt for more information ``` %pylab inline import re import xml.sax.saxutils as saxutils from BeautifulSoup import BeautifulSoup from gensim.models.word2vec import Word2Vec from keras.models import Sequ...
github_jupyter
<a href="https://colab.research.google.com/github/technologyhamed/Neuralnetwork/blob/Single/ArticleSummarization/ArticleSummarization.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> *قسمت 1: پیدا کردن امتیاز TF IDF هر کلمه ابتدا فایل خوانده می شود ...
github_jupyter
``` import numpy as np from scipy.stats import norm from stochoptim.scengen.scenario_tree import ScenarioTree from stochoptim.scengen.scenario_process import ScenarioProcess from stochoptim.scengen.variability_process import VariabilityProcess from stochoptim.scengen.figure_of_demerit import FigureOfDemerit ``` We il...
github_jupyter
### 3. Tackle the Titanic dataset ``` # To support both python 2 and python 3 # 让这份笔记同步支持 python 2 和 python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make this notebook's output stable across runs # 让笔记全程输入稳定 np.random.seed(42) # To plot p...
github_jupyter
``` import os, sys, time, importlib import geopandas as gpd import pandas as pd import networkx as nx sys.path.append('/home/wb514197/Repos/GOSTnets') import GOSTnets as gn import GOSTnets.calculate_od_raw as calcOD from GOSTnets.load_osm import * import rasterio as rio from osgeo import gdal import numpy as np from ...
github_jupyter
[Binary Tree Tilt](https://leetcode.com/problems/binary-tree-tilt/)。定义倾斜程度,节点的倾斜程度等于左子树节点和与右子树节点和的绝对差,而整棵树的倾斜程度等于所有节点倾斜度的和。求一棵树的倾斜程度。 思路:因为求倾斜程度牵涉到节点的累计和,所以在设计递归函数时返回一个累加和。 ``` def findTilt(root: TreeNode) -> int: res = 0 def rec(root): # 返回累加和的递归函数 if not root: return 0 nonlo...
github_jupyter
# All ## Set Up ``` print("Installing dependencies...") %tensorflow_version 2.x !pip install -q t5 import functools import os import time import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) import tensorflow.compat.v1 as tf import tensorflow_datasets as tfds import t5 ``` ## Set UP TPU ...
github_jupyter
``` import tensorflow as tf import math print('TensorFlow version: ' + tf.__version__) from tensorflow.examples.tutorials.mnist import input_data as mnist_data mnist = mnist_data.read_data_sets("../MNIST_data", one_hot=True, reshape=True, validation_size=0) x_train = mnist.train.images # we will not be using these to ...
github_jupyter
``` import os os.environ['CUDA_VISIBLE_DEVICES'] = '' import malaya_speech.train.model.alconformer as conformer import malaya_speech.train.model.transducer as transducer import malaya_speech import tensorflow as tf import numpy as np subwords = malaya_speech.subword.load('transducer.subword') featurizer = malaya_speec...
github_jupyter
# Providing your notebook ## It's all JSON ``` !head -20 tour.ipynb ``` # Deliver as HTML ## nbconvert $ jupyter nbconvert tour.ipynb [NbConvertApp] Converting notebook tour.ipynb to html [NbConvertApp] Writing 219930 bytes to tour.html [tour.html](tour.html) ## hosted static ### Raw HTML online...
github_jupyter
``` from pathlib import Path from matplotlib import rcParams rcParams['font.family'] = 'sans-serif' rcParams['font.sans-serif'] = ['Arial'] import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import pyprojroot import seaborn as sns import searchnets def cm_to_inches(cm): ...
github_jupyter
<!---------------------- Introduction Section -------------------> <h1> PTRAIL: A <b><i>P</i></b>arallel <b><i>TR</i></b>ajectory d<b><i>A</i></b>ta preprocess<b><i>I</i></b>ng <b><i>L</i></b>ibrary </h1> <h2> Introduction </h2> <p align='justify'> PTRAIL is a state-of-the art Mobility Data Preprocessing Library tha...
github_jupyter
# Modeling and Simulation in Python Chapter 10 Copyright 2017 Allen Downey License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0) ``` # Configure Jupyter so figures appear in the notebook %matplotlib inline # Configure Jupyter to display the assigned value after an a...
github_jupyter
``` import pandas as pd bx_ratings = pd.read_csv('BX-Book-Ratings.csv') bx_books = pd.read_csv('BX-Books.csv') bx_users = pd.read_csv('BX-Users.csv') bx_ratings.head() print len(bx_ratings), len(bx_books), len(bx_users) print len(bx_ratings) #bx_ratings = bx_ratings[ bx_ratings['Book-Rating'] != 0] print len(bx_ratings...
github_jupyter
# Autonomous driving - Car detection Welcome to your week 3 programming assignment. You will learn about object detection using the very powerful YOLO model. Many of the ideas in this notebook are described in the two YOLO papers: [Redmon et al., 2016](https://arxiv.org/abs/1506.02640) and [Redmon and Farhadi, 2016](h...
github_jupyter
``` import os import sys import torch import gpytorch from tqdm.auto import tqdm import timeit if os.path.abspath('..') not in sys.path: sys.path.insert(0, os.path.abspath('..')) from gpytorch_lattice_kernel import RBFLattice as BilateralKernel # device = "cuda" if torch.cuda.is_available() else "cpu" device = "cp...
github_jupyter
# Checking the OA status of an author's papers ``` import json import orcid import requests import sys import time from IPython.display import HTML, display ``` ORCID of the author you want to check ``` ORCID = '0000-0001-5318-3910' ``` Sadly, to make requests to ORCID and Base APIs, you will need to register with ...
github_jupyter
# Homework 1: Wine Rating with Pandas and Sklearn ### 1. Read the syllabus in its entirety. Mark “Yes” below. _____ I have read and understood the syllabus for this class. ### 2. MTC (MegaTelCo) has decided to use supervised learning to address its problem of churn in its wireless phone business. As a consultant t...
github_jupyter
``` import SimpleITK as sitk import numpy as np import os def normalize_one_volume(volume): new_volume = np.zeros(volume.shape) location = np.where(volume != 0) mean = np.mean(volume[location]) var = np.std(volume[location]) new_volume[location] = (volume[location] - mean) / var return new_vol...
github_jupyter
<h1> Getting started with TensorFlow </h1> In this notebook, you play around with the TensorFlow Python API. ``` import tensorflow as tf import numpy as np print(tf.__version__) ``` <h2> Adding two tensors </h2> First, let's try doing this using numpy, the Python numeric package. numpy code is immediately evaluate...
github_jupyter
### Linear SCM simulations with variance shift noise interventions in Section 5.2.2 variance shift instead of mean shift | Sim Num | name | better estimator | baseline | | :-----------: | :--------------------------------|:----------------:| :-------:| | (viii) | Single sour...
github_jupyter
# General Imports !! IMPORTANT !! If you did NOT install opengrid with pip, make sure the path to the opengrid folder is added to your PYTHONPATH ``` import os import inspect import sys import pandas as pd import charts from opengrid_dev.library import houseprint import matplotlib.pyplot as plt %matplot...
github_jupyter
# Transfer Learning In this notebook, you'll learn how to use pre-trained networks to solved challenging problems in computer vision. Specifically, you'll use networks trained on [ImageNet](http://www.image-net.org/) [available from torchvision](http://pytorch.org/docs/0.3.0/torchvision/models.html). ImageNet is a m...
github_jupyter
# Demonstration of PET OSEM reconstruction with SIRF This demonstration shows how to use OSEM as implemented in SIRF. It also suggests some exercises for reconstruction with and without attenuation etc. The notebook is currently set-up to use prepared data with a single slice of an XCAT phantom, with a low resolution ...
github_jupyter
``` import matplotlib matplotlib.use('Qt5Agg') import matplotlib.pyplot as plt from src.utils import * from src.InstrumentalVariable import InstrumentalVariable from tqdm.notebook import tnrange def run_manifold_tests(X, y, min_p_value=80, max_p_value=95, bootstrap=True, min_l2_reg=0, max_l2_reg=...
github_jupyter
# Linear algebra Linear algebra is the branch of mathematics that deals with **vector spaces**. ``` import re, math, random # regexes, math functions, random numbers import matplotlib.pyplot as plt # pyplot from collections import defaultdict, Counter from functools import partial, reduce ``` # Vectors Vectors are p...
github_jupyter
``` from scipy.cluster.hierarchy import linkage, fcluster import matplotlib.pyplot as plt import seaborn as sns, pandas as pd x_coords = [80.1, 93.1, 86.6, 98.5, 86.4, 9.5, 15.2, 3.4, 10.4, 20.3, 44.2, 56.8, 49.2, 62.5] y_coords = [87.2, 96.1, 95.6, 92.4, 92.4, 57.7, 49.4, 47.3, 59.1, 55.5, 25.6, 2.1, 10.9, 24.1] df = ...
github_jupyter
# Gradient Descent :label:`sec_gd` In this section we are going to introduce the basic concepts underlying gradient descent. This is brief by necessity. See e.g., :cite:`Boyd.Vandenberghe.2004` for an in-depth introduction to convex optimization. Although the latter is rarely used directly in deep learning, an underst...
github_jupyter
## Demo 4: HKR multiclass and fooling [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/deel-ai/deel-lip/blob/master/doc/notebooks/demo4.ipynb) This notebook will show how to train a lispchitz network in a multiclass setup. The HKR is extended to mult...
github_jupyter
``` using Tensorflow; using static Tensorflow.Binding; using PlotNET; using NumSharp; int training_epochs = 1000; // Parameters float learning_rate = 0.01f; int display_step = 50; NumPyRandom rng = np.random; NDArray train_X, train_Y; int n_samples; train_X = np.array(3.3f, 4.4f, 5.5f, 6.71f, 6.93f, 4.168f, 9.779f, 6...
github_jupyter
# Representing Qubit States You now know something about bits, and about how our familiar digital computers work. All the complex variables, objects and data structures used in modern software are basically all just big piles of bits. Those of us who work on quantum computing call these *classical variables.* The comp...
github_jupyter
# Informer ### Uses informer model as prediction of future. ``` import os, sys from tqdm import tqdm from subseasonal_toolkit.utils.notebook_util import isnotebook if isnotebook(): # Autoreload packages that are modified %load_ext autoreload %autoreload 2 else: from argparse import ArgumentParser impo...
github_jupyter
``` import os import glob import json import pandas as pd def load_gpu_util(dlprof_summary_file): with open(dlprof_summary_file) as json_file: summary = json.load(json_file) gpu_util_raw = summary["Summary Report"] gpu_util = { "sm_util": float(100 - gpu_util_raw["GPU Idle %"][0]), "...
github_jupyter
# COMP305 -> 2-median problem on Optimal Placement of 2 Hospitals ## Imports ``` import time import heapq import numpy as np from collections import defaultdict from collections import Counter from random import choice from random import randint ``` ## Data Read ``` #with open("tests/test1_new.txt") as f: # t...
github_jupyter
# Loading Medicare and Medicaid Claims data into i2b2 [CMS RIF][] docs This notebook is on demographics. [CMS RIF]: https://www.resdac.org/cms-data/file-availability#research-identifiable-files ## Python Data Science Tools especially [pandas](http://pandas.pydata.org/pandas-docs/) ``` import pandas as pd import n...
github_jupyter
# Project - Feature Engineering on the Titanic The titanic dataset has a few columns from which you can use regex to extract information from. Feature engineering involves using existing columns of data to create new columns of data. You will work on doing just that in these exercises. Read it in and then answer the fo...
github_jupyter
<table class="ee-notebook-buttons" align="left"> <td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Join/inverted_joins.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td> <td><a target="_blank" href="ht...
github_jupyter
``` # Copyright 2021 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
# Pixelwise Segmentation Use the `elf.segmentation` module for feature based instance segmentation from pixels. Note that this example is educational and there are easier and better performing method for the image used here. These segmentation methods are very suitable for pixel embeddings learned with neural networks...
github_jupyter
# Vowpal Wabbit and LightGBM for a Regression Problem This notebook shows how to build simple regression models by using [Vowpal Wabbit (VW)](https://github.com/VowpalWabbit/vowpal_wabbit) and [LightGBM](https://github.com/microsoft/LightGBM) with SynapseML. We also compare the results with [Spark MLlib Linear Re...
github_jupyter
# CC3501 - Aux 7: Método de Diferencias Finitas #### **Profesor: Daniel Calderón** #### **Auxiliares: Diego Donoso y Pablo Pizarro** #### **Ayudantes: Francisco Muñoz, Matías Rojas y Sebastián Contreras** ##### Fecha: 31/05/2019 --- #### Objetivos: * Ejercitar el método de diferencias finitas en una aplicación práctic...
github_jupyter
``` # Discretization example # We will use the titanic dataset import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier # Load the dataset. We will only load 4 features. # The class is "Survived" (0 or 1...
github_jupyter
## test.ipynb: Test the training result and Evaluate model ``` # Import the necessary libraries from sklearn.decomposition import PCA import os import scipy.io as sio import numpy as np from keras.models import load_model from keras.utils import np_utils from sklearn.metrics import classification_report, confusion_mat...
github_jupyter
# Pendulum Environment, OpenAI Gym * Left force: -50N, Right force: 50N, Nothing: 0N, with some amount of noise added to the action * Generate trajectories by starting upright, and then applying random forces. * Failure if the pendulum exceeds +/- pi/2 * Setting this problem up: how to encode Newtons? I'm starting thi...
github_jupyter
# __Conceptos de estadística e introducción al análisis estadístico de datos usando Python__ ``` #Importa las paqueterías necesarias import numpy as np import matplotlib.pyplot as pit import pandas as pd import seaborn as sns import pandas_profiling as pp from joblib import load, dump import statsmodels.api as sm ``...
github_jupyter
``` import json import numpy as np import tensorflow as tf import collections from sklearn.cross_validation import train_test_split with open('ctexts.json','r') as fopen: ctexts = json.loads(fopen.read())[:200] with open('headlines.json','r') as fopen: headlines = json.loads(fopen.read())[:200] def build_d...
github_jupyter
``` import random from collections import deque from copy import deepcopy import gym import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from torch.distributions import Categorical from IPython.display import clear_ou...
github_jupyter
# Basic chemical, electrical, and thermodynamic principles To develop a quantitative understanding of how these processes work, we start with a set of definitions of the some quantities and concepts with which we are concerned. Specifically, this section reviews basic biochemical, thermodynamic, and related concepts t...
github_jupyter
# Default of credit card clients Data Set ### Data Set Information: This research aimed at the case of customers’ default payments in Taiwan and compares the predictive accuracy of probability of default among six data mining methods. From the perspective of risk management, the result of predictive accuracy of the...
github_jupyter
``` #IMPORT SEMUA LIBRARY DISINI #IMPORT LIBRARY PANDAS import pandas as pd #IMPORT LIBRARY POSTGRESQL import psycopg2 from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT #IMPORT LIBRARY CHART from matplotlib import pyplot as plt from matplotlib import style #IMPORT LIBRARY PDF from fpdf import FPDF #IMPORT LIBR...
github_jupyter
# Translating Story Map from one language to another using Deep Learning <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"> <ul class="toc-item"> <li><span><a href="#Introduction" data-toc-modified-id="Introduction-1">Introduction</a></span></li> <li><span><a href="#Prerequisites" data-toc-modif...
github_jupyter
MNIST classification (drawn from sklearn example) ===================================================== MWEM is not particularly well suited for image data (where there are tons of features with relatively large ranges) but it is still able to capture some important information about the underlying distributions if tun...
github_jupyter
# Dataset Descriptions This notebook contains most of the datasets used in Pandas Cookbook along with the names, types, descriptions and some summary statistics of each column. This is not an exhaustive list as several datasets used in the book are quite small and are explained with enough detail in the book itself. Th...
github_jupyter
___ <a href='https://www.udemy.com/user/joseportilla/'><img src='../Pierian_Data_Logo.png'/></a> ___ <center><em>Content Copyright by Pierian Data</em></center> # Working with CSV Files Welcome back! Let's discuss how to work with CSV files in Python. A file with the CSV file extension is a Comma Separated Values fi...
github_jupyter
# T-ABSA Logistic Regression Model using word2vec #### Preprocessing the reviews Importing the libraries for preprocessing the reviews ``` import os import pandas as pd import nltk from gensim.models import Word2Vec, word2vec import matplotlib.pyplot as plt import numpy as np from nltk.corpus import stopwords import...
github_jupyter
# k-NN movie reccomendation | User\Film | Movie A | Movie B | Movie C | ... | Movie # | |---------------------------------------------------------| | **User A**| 3 | 4 | 0 | ... | 5 | | **User B**| 0 | 3 | 2 | ... | 0 | | **User C**| 4 | 1 | 3 | ... | ...
github_jupyter
``` import pandas as pd from pathlib import Path import numpy as np import seaborn as sns from sklearn.pipeline import make_pipeline import statsmodels.api as sm from yellowbrick.model_selection import LearningCurve from yellowbrick.regressor import ResidualsPlot from yellowbrick.regressor import PredictionError from ...
github_jupyter
# Django2.2 **Python Web Framework**:<https://wiki.python.org/moin/WebFrameworks> 先说句大实话,Web端我一直都是`Net技术站`的`MVC and WebAPI`,Python我一直都是用些数据相关的知识(爬虫、简单的数据分析等)Web这块只是会Flask,其他框架也都没怎么接触过,都说`Python`的`Django`是`建站神器`,有`自动生成后端管理页面`的功能,于是乎就接触了下`Django2.2`(目前最新版本) > 逆天点评:Net的MVC最擅长的就是(通过Model+View)`快速生成前端页面和对应的验证`,而Python的`Dj...
github_jupyter
``` ls -l| tail -10 #G4 from google.colab import drive drive.mount('/content/gdrive') cp gdrive/My\ Drive/fingerspelling5.tar.bz2 fingerspelling5.tar.bz2 # rm fingerspelling5.tar.bz2 # cd /media/datastorage/Phong/ !tar xjf fingerspelling5.tar.bz2 cd dataset5 mkdir surrey mkdir surrey/E mv dataset5/* surrey/E/ cd .. #re...
github_jupyter
# Mean Reversion on Futures by Rob Reider and Maxwell Margenot Part of the Quantopian Lecture Series: * [www.quantopian.com/lectures](https://www.quantopian.com/lectures) * [github.com/quantopian/research_public](https://github.com/quantopian/research_public) Notebook released under the Creative Commons Attribution ...
github_jupyter
# Dijkstra's Algorithm In this exercise, you'll implement Dijkstra's algorithm. First, let's build the graph. ## Graph Representation In order to run Dijkstra's Algorithm, we'll need to add distance to each edge. We'll use the `GraphEdge` class below to represent each edge between a node. ``` class GraphEdge(object): ...
github_jupyter
# Pipelining In Machine Learning ``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split # save filepath to variable for easier access melbourne_file_path = '../hitchhikersGuideToMachineLearning/home-data-for-ml-course/train.csv' # read the data and store data in DataFrame title...
github_jupyter
## A Classifier Model Performance Evaluation The material for evaluting a classifier here are applied to all classifiers We focused our concentration to Logistic Regression Read this to undestand what is Logistic Regression: https://www.datacamp.com/community/tutorials/understanding-logistic-regression-python ## Ac...
github_jupyter
# Ejemplo: Reducción de palabras a su raíz (Stemming) en textos **Autor:** Unidad de Científicos de Datos (UCD) --- Este ejemplo muestra las principales funcionalidades del módulo `stemming`, de la librería **ConTexto**. Este módulo permite aplicar *stemming* a textos. El *stemming* es un método para reducir una palab...
github_jupyter
# 1.0 Visualizing Frequency Distributions ## 1.1 Visualizing Distributions To find patterns in a frequency table we have to look up the frequency of each unique value or class interval and at the same time compare the frequencies. This process can get time consuming for tables with many unique values or class interva...
github_jupyter
# NTDS'18 milestone 1: network collection and properties [Effrosyni Simou](https://lts4.epfl.ch/simou), [EPFL LTS4](https://lts4.epfl.ch) ## Students * Team: `42` * Students: `Alexandre Poussard, Robin Leurent, Vincent Coriou, Pierre Fouché` * Dataset: [`Flight routes`](https://openflights.org/data.html) ## Rules *...
github_jupyter
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-59152712-8'); </script> # Start-to-Finish Example: Evolving Maxwell's Equations wit...
github_jupyter
``` import matplotlib # matplotlib.use('Agg') # Or any other X11 back-end import numpy as np import torch.nn as nn import torch.nn.init as init import matplotlib.pyplot as plt import numpy as np import os from scipy import signal import time import torch import torch.nn as nn from torch.autograd import Variable...
github_jupyter
# 1A.data - Décorrélation de variables aléatoires On construit des variables corrélées gaussiennes et on cherche à construire des variables décorrélées en utilisant le calcul matriciel. ``` from jyquickhelper import add_notebook_menu add_notebook_menu() ``` Ce TD appliquera le calcul matriciel aux vecteurs de variab...
github_jupyter
# CME Session ### Goals 1. Search and download some coronagraph images 2. Load into Maps 3. Basic CME front enhancement 4. Extract CME front positions 6. Convert positions to height 5. Fit some simple models to height-time data ``` %matplotlib notebook import warnings warnings.filterwarnings("ignore") import astr...
github_jupyter
# GPU-accelerated LightGBM This kernel explores a GPU-accelerated LGBM model to predict customer transaction. ## Notebook Content 1. [Re-compile LGBM with GPU support](#1) 1. [Loading the data](#2) 1. [Training the model on CPU](#3) 1. [Training the model on GPU](#4) 1. [Submission](#5) <a id="1"></a> ## 1. Re-com...
github_jupyter
``` import matplotlib import matplotlib.pyplot as plt from mmcg import mmcg import numpy as np import operator import pyart radar = pyart.io.read('/home/zsherman/sgpxsaprcmacsurI5.c1.20171004.203018.nc') grid = mmcg(radar, grid_shape=(31, 101, 101), grid_limits=((0, 15000), (-50000, 50000), (-50000, 50000))...
github_jupyter
# Predictable t-SNE [t-SNE](https://scikit-learn.org/stable/modules/generated/sklearn.manifold.TSNE.html) is not a transformer which can produce outputs for other inputs than the one used to train the transform. The proposed solution is train a predictor afterwards to try to use the results on some other inputs the mo...
github_jupyter
# Wiener Filter + UNet https://github.com/vpronina/DeepWienerRestoration ``` # Import some libraries import numpy as np from skimage import color, data, restoration import matplotlib.pyplot as plt import torch import utils import torch.nn as nn from networks import UNet import math import os from skimage import io i...
github_jupyter
``` import torch import numpy as np import torch.utils.data from utils import dataloader from models.casenet import casenet101 as CaseNet101 import os import cv2 import tqdm import argparse import argparse import os import random import shutil import time import warnings import math import numpy as np from PIL import...
github_jupyter
``` from pyxnat import Interface import xmltodict import xnat_downloader.cli.run as run from pyxnat import Inspector import os ``` ### Play 04/11/2018 ``` central = Interface(server="https://central.xnat.org", user='') project = 'xnatDownload' subject = 'sub-001' proj_obj = central.select.project(project) proj_obj.ex...
github_jupyter
# Session #5: Automate ML workflows and focus on innovation (300) In this session, you will learn how to use [SageMaker Pipelines](https://docs.aws.amazon.com/sagemaker/latest/dg/pipelines-sdk.html) to train a [Hugging Face](https://docs.aws.amazon.com/sagemaker/latest/dg/hugging-face.html) Transformer model and deplo...
github_jupyter
# Assignment 2 For this assignment you'll be looking at 2017 data on immunizations from the CDC. Your datafile for this assignment is in [assets/NISPUF17.csv](assets/NISPUF17.csv). A data users guide for this, which you'll need to map the variables in the data to the questions being asked, is available at [assets/NIS-P...
github_jupyter
## Multiple Output Models + Multi Tast Elastic Net + Multi Task Models ``` import pandas as pd import numpy as np from sklearn.linear_model import MultiTaskElasticNet from sklearn.multioutput import MultiOutputRegressor from sklearn.linear_model import LinearRegression from sklearn.tree import DecisionTreeRegressor fr...
github_jupyter