text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Generate QWI Statistics ## Python Setup ``` %pylab inline # from __future__ import division import pandas as pd import psycopg2 # import seaborn as sns # sns.set_style("white") # sns.set_context("poster", font_scale=1.25, rc={"lines.linewidth":1.25, "lines.markersize":8}) ``` ## Connection to Database ``` db_nam...
github_jupyter
# Gradient Centralization for Better Training Performance **Author:** [Rishit Dagli](https://github.com/Rishit-dagli)<br> **Date created:** 06/18/21<br> **Last modified:** 06/18/21<br> **Description:** Implement Gradient Centralization to improve training performance of DNNs. ## Introduction This example implements ...
github_jupyter
``` import numpy as np import pandas as pd import torch import torchvision from torch.utils.data import Dataset, DataLoader from torchvision import transforms, utils import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from matplotlib import pyplot as plt %matplotlib inline torch.backends...
github_jupyter
# Petfinder.my - Pawpularity Contest Predict the popularity of shelter pet photos <img src="https://storage.googleapis.com/kaggle-competitions/kaggle/25383/logos/header.png"></img> Analyze raw images and metadata to predict the “Pawpularity” of pet photos. The Pawpularity Score is derived from each pet profile's page ...
github_jupyter
<img alt="QuantRocket logo" src="https://www.quantrocket.com/assets/img/notebook-header-logo.png"> © Copyright Quantopian Inc.<br> © Modifications Copyright QuantRocket LLC<br> Licensed under the [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/legalcode). <a href="https://www.quantrocke...
github_jupyter
``` from PIL import Image import pandas as pd import requests import psycopg2 import io from ratelimiter import RateLimiter from tqdm import tqdm from ast import literal_eval #postgres connection db_user = 'postgres' db_password = '' db_host = 'localhost' db_port = 5432 database = 'met_data' conn_str = f'postgresql:/...
github_jupyter
# 附录A:关于布莱克-斯科尔斯-默顿模型的一些有用的推导式 BSM价格表达式如下: $$C(S,K,\tau,\sigma,r)=SN(d_1)-Ke^{-r\tau}N(d_2)$$ $$d_1=\frac{\ln\left(\frac{S_F}{K}\right)+\frac{\sigma^2}{2}\tau}{\sigma\sqrt{\tau}}$$ $$d_2=\frac{\ln\left(\frac{S_F}{K}\right)-\frac{\sigma^2}{2}\tau}{\sigma\sqrt{\tau}}$$ $$S_F=e^{r\tau}S$$ $$N(x)=\frac{1}{\sqrt{2\pi}}...
github_jupyter
``` #@title ##### License # Copyright 2018 The GraphNets Authors. 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 # # Un...
github_jupyter
``` import numpy as np import torch import torch.nn as nn from torch.utils.data import DataLoader import torchvision.utils as vutils from torchvision import datasets, transforms import matplotlib.pyplot as plt transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=(0.5,), std=(0.5,))]...
github_jupyter
# 1810 - Comparing CNN architectures ``` # Imports import sys import os import time import math import random # Add the path to the parent directory to augment search for module par_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir)) if par_dir not in sys.path: sys.path.append(par_dir) # Plotting imp...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import requests import datetime as dt from sklearn.decomposition import PCA from patsy import dmatrices import statsmodels.api as sm import statsmodels.formula.api as smf import warnings warnings.filterwarnings("ignore") import pymc3 as pm impor...
github_jupyter
# Basics of Coding In this chapter, you'll learn about the basics of objects, types, operations, conditions, loops, functions, and imports. These are the basic building blocks of almost all programming languages. This chapter has benefited from the excellent [*Python Programming for Data Science*](https://www.tomasbe...
github_jupyter
<table> <tr align=left><td><img align=left src="./images/CC-BY.png"> <td>Text provided under a Creative Commons Attribution license, CC-BY. All code is made available under the FSF-approved MIT license. (c) Marc Spiegelman</td> </table> ``` %matplotlib inline import numpy as np import scipy.linalg as la import matpl...
github_jupyter
# 10. Непрерывные случайные величины. Плотность. <img src='data/r3.png' width=400/> <img src='data/r1.png' width=400/> <img src='data/lebeg.png' width=400/> ## Содержание * [Теория](#chapter1) * [Задачи на пару](#chapter2) * [Домашнее задание](#chapter3) * [Гробы](#chapter4) ## Теория <a class="anchor" id="chapte...
github_jupyter
``` import pandas as pd import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline df = pd.read_csv(r"G:\Udemy Courses\Data Science\Refactored_Py_DS_ML_Bootcamp-master\13-Logistic-Regression\titanic_train.csv") df.head() df.describe() df.columns df.isnull().sum() sns.heatmap(df.isnull(),cbar=False,ytickla...
github_jupyter
``` %load_ext autoreload %autoreload 2 import os,sys,inspect current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) parent_dir = os.path.dirname(os.path.dirname(current_dir)) sys.path.insert(0, parent_dir) import numpy as np import torch import torch.nn as nn import torch.nn.function...
github_jupyter
``` import numpy as np import pandas as pd #import matplotlib.pylab as plt import matplotlib.pyplot as plt from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import silhouette_score from sklearn import cluster from sklearn.cluster import KMeans from sklearn.datasets import make_blobs import seaborn as ...
github_jupyter
# Introduction to Data Visualization with Seaborn ### Data file : graduates.csv [https://think.cs.vt.edu/corgis/csv/graduates] This file contains information about students graduating from American institutes for 11 years between 1993 and 2015. For every year and Major of graduation, there is information about the dist...
github_jupyter
``` %matplotlib inline import gym import matplotlib import numpy as np import sys from collections import defaultdict if "../" not in sys.path: sys.path.append("../") from lib.envs.blackjack import BlackjackEnv from lib import plotting matplotlib.style.use('ggplot') env = BlackjackEnv() def mc_prediction(policy,...
github_jupyter
## AI for Medicine Course 1 Week 1 lecture exercises # Data Exploration In the first assignment of this course, you will work with chest x-ray images taken from the public [ChestX-ray8 dataset](https://arxiv.org/abs/1705.02315). In this notebook, you'll get a chance to explore this dataset and familiarize yourself wit...
github_jupyter
## **Git Routine 2**: Extend your current code and use Git, GitHub to keep track of changes and contribute to collaborative projects In this exercise, we will use the personal forks as the repository where each of us will contribute. ## 1. Navigate into your folder named under your GitHub username ``` cd <my usernam...
github_jupyter
# 6.1 量子搜索算法 ## 练习 6.1 :::{admonition} 练习 6.1 证明对应于 Grover 迭代中,相移的酉算符是 $2 |0\rangle \langle0| - I$。 ::: 这是比较显然的。一种理解方式是矩阵表示。另一种则是将该相移算符作用于具体的态 (下式的 $x > 0$): $$ \begin{align*} (2 |0\rangle \langle0| - I) |0\rangle &= 2 |0\rangle \langle0|0\rangle - |0\rangle = |0\rangle \\ (2 |0\rangle \langle0| - I) |x\rangle &=...
github_jupyter
<a id='start'></a> # Decision Tree In questo notebook viene spiegato cosa sono e come possiamo realizzare dei Decision Tree con Python. <br> <br> Il notebook è suddiviso nelle seguenti sezioni:<br> - [Definizione](#section1) - [Esempio](#section2) - [Lavoriamo con Python](#section3) - [I boosted decision trees](#secti...
github_jupyter
<a href="https://colab.research.google.com/github/mc-robinson/random/blob/master/pytorch_and_fastai_molecular_tabular_learner.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Attempting to use molecular data with fastai/pytorch ``` # must use new ...
github_jupyter
<center> <img src="https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-ML0101EN-SkillsNetwork/labs/Module%202/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Simple Linear Regression Estimated time needed: **15** minutes ## Objectives After ...
github_jupyter
# K-Nearest Neighbor Regressor with StandardScaler This Code template is for the regression analysis using a simple KNeighborsRegressor based on the K-Nearest Neighbors algorithm and feature rescaling technique StandardScaler in a pipeline. ### Required Packages ``` import warnings import numpy as np import panda...
github_jupyter
# Inception_V3 model summary ``` import tensorflow as tf import keras.backend.tensorflow_backend as KTF gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333) sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) from keras.applications.inception_v3 import InceptionV3 model = InceptionV3() p...
github_jupyter
## Dependencies ``` !pip install --quiet efficientnet # !pip install --quiet image-classifiers import warnings, json, re, glob, math # from scripts_step_lr_schedulers import * from melanoma_utility_scripts import * from kaggle_datasets import KaggleDatasets from sklearn.model_selection import KFold import tensorflow.k...
github_jupyter
``` import torch import numpy as np x= torch.tensor([[1,2,3],[4,5,6]]) y= torch.tensor([[7,8,9], [10,11,12]]) f= 2*x + y print(f) shape=[2,3] xzeros =torch.zeros(shape) xones = torch.ones(shape) xrnd = torch.rand(shape) print(xzeros) print(xones) print(xrnd) torch.manual_seed(42) print(torch.rand([2,3])) import numpy ...
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
# χ² DISTRIBUSION AND χ² TEST 2020.01.23 ``` """ _______________________________ Chi-squere distribusion _______________________________ * SciPy https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chi2.html * Returned Value: sum of squared x-e...
github_jupyter
# Multitask GP Regression ## Introduction Multitask regression, introduced in [this paper](https://papers.nips.cc/paper/3189-multi-task-gaussian-process-prediction.pdf) learns similarities in the outputs simultaneously. It's useful when you are performing regression on multiple functions that share the same inputs, e...
github_jupyter
<a id="section0"></a> ![Aula10.png](attachment:Aula10.png) ## O que vamos aprender nessa aula: 1. [Paradigmas de Programação](#1.-Paradigmas-de-Programação)<br> 1.1. [Programação Imperativa](#1.1.-Programação-Imperativa)<br> 1.2. [Programação Orientada a Objetos](#1.2.-Programação-Orientada-a-Objetos)<br> ...
github_jupyter
|<img style="float:left;" src="http://pierreproulx.espaceweb.usherbrooke.ca/images/usherb_transp.gif" > |Pierre Proulx, ing, professeur| |:---|:---| |Département de génie chimique et de génie biotechnologique |** GCH200-Phénomènes d'échanges I **| ### Section 10.7, Conduction de la chaleur dans une ailette <img src='h...
github_jupyter
``` import pandas as pd import numpy as np import os raw_data_path=os.path.join(os.path.pardir,'data','raw') train_file_path=os.path.join(raw_data_path,'train.csv') test_file_path=os.path.join(raw_data_path,'test.csv') #read the data with all default params train_df=pd.read_csv(train_file_path,index_col='PassengerId') ...
github_jupyter
# Imports ``` import pandas as pd import numpy as np import pathlib import calendar import pickle pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', None) ``` # Data Connection ``` from sqlalchemy import create_engine database_filename = 'tdpdata.db' table_name = 'tdpsheet' engine = creat...
github_jupyter
# Re-creating [Capillary Hysteresis in Neutrally Wettable Fibrous Media: A Pore Network Study of a Fuel Cell Electrode](http://link.springer.com/10.1007/s11242-017-0973-2) # Part C: Purcell Meniscus Model ## Introduction In the final part of this series we take a deeper look at the Purcell meniscus model, which is ce...
github_jupyter
``` # Standard library imports from argparse import ArgumentParser import os, sys THIS_DIR = os.path.abspath('') PARENT_DIR = os.path.dirname(os.path.abspath('')) sys.path.append(PARENT_DIR) # Third party imports import torch from torch.nn import functional as F from torch.utils.data import DataLoader import pytorch_l...
github_jupyter
``` !pip install transformers==4.11.2 datasets soundfile sentencepiece torchaudio pyaudio from transformers import * import torch import soundfile as sf # import librosa import os import torchaudio # model_name = "facebook/wav2vec2-base-960h" # 360MB model_name = "facebook/wav2vec2-large-960h-lv60-self" # 1.18GB proce...
github_jupyter
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. ![Impressions](https://PixelServer20190423114238.azurewebsites.net/api/impressions/MachineLearningNotebooks/how-to-use-azureml/automated-machine-learning/continous-retraining/auto-ml-continuous-retraining.png) # Automated Mach...
github_jupyter
# Python ``` 파이썬은 모든 것이 객체이다. 객체는 어떠한 속성값과 행동을 가지고 있는 데이터이다. ``` ## [파이썬 인터프리터] ``` 우리가 파이썬 코드를(스크립트를) 작성하고 실행하면 이 코드는 먼저 바이트 코드라는 것으로 변환되어 어딘가에 저장되고 이 바이트 코드는 파이썬 가상 머신(python virtual machine : PVM) 위에서 실행이 된다. 실제 파이썬의 프로그램 실행 주체는 PVM이고 PVM에 의해 가비지 컬렉션도 진행이 된다. 파이썬 코드 변환기와 가상 머신, 기본적으로 포함되는 각종 라이브러리들을 묶어서 파이썬 인터프...
github_jupyter
# Introduction ## A quick overview of batch learning If you've already delved into machine learning, then you shouldn't have any difficulty in getting to use incremental learning. If you are somewhat new to machine learning, then do not worry! The point of this notebook in particular is to introduce simple notions. W...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt % matplotlib inline plt.rcParams["figure.dpi"] = 300 np.set_printoptions(precision=3, suppress=True) import pandas as pd from sklearn.model_selection import train_test_split, cross_val_score from sklearn.pipeline import make_pipeline from sklearn.preprocessing impo...
github_jupyter
``` %load_ext autoreload %autoreload 2 from childes_mi.utils.paths import DATA_DIR, FIGURE_DIR from childes_mi.utils.general import flatten,save_fig from childes_mi.information_theory import model_fitting as mf import pandas as pd import numpy as np import matplotlib.pyplot as plt from tqdm.autonotebook import tqdm MI_...
github_jupyter
``` %%html <style> table {float:left} </style> ``` # Jinja2 Simple YAML Example --- We're now going to take a look at grabbing a file from the hard drive written in [YAML](http://www.yaml.org/) syntax. YAML is arguably the most human readable data serialization format which makes it really easy for coders and non-co...
github_jupyter
``` %run notebook_setup ``` # Getting started with The Joker *The Joker* (pronounced Yo-kurr) is a highly specialized Monte Carlo (MC) sampler that is designed to generate converged posterior samplings for Keplerian orbital parameters, even when your data are sparse, non-uniform, or very noisy. This is *not* a genera...
github_jupyter
## Protodash Explanations for Text data In the example shown in this notebook, we train a text classifier based on [UCI SMS dataset](https://archive.ics.uci.edu/ml/datasets/SMS+Spam+Collection) to distinguish 'SPAM' and 'HAM' (i.e. non spam) SMS messages. We then use the ProtodashExplainer to obtain spam and ham proto...
github_jupyter
PyGSLIB ======== Declustering --------------- This is how declustering works ``` #general imports import matplotlib.pyplot as plt import pygslib import numpy as np #make the plots inline %matplotlib inline ``` Getting the data ready for work --------- If the data is in GSLIB format you can use the function `p...
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> # The Spinning Effective One-Body Factorized Modes ## Auth...
github_jupyter
``` install.packages('gbm') library(gbm) ``` # Read training data file ``` train_raw <- read.table("../data/train_FD001.txt", sep=" ", colClasses=c(rep("numeric", 2), rep("double", 24), rep("NULL", 2)), col.name=c("id", "cycle", "setting1", "setting2", "setting3", "s1", "s2", "s3", "s4", ...
github_jupyter
# Change-over-Time Give emphasis to changing trends. These can be short (intra-day) movements or extended series traversing decades or centuries: Choosing the correct time period is important to provide suitable context for the reader. ``` import pandas as pd import numpy as np #ggplot equivalent: plotnine from plotni...
github_jupyter
##### Copyright 2020 The TensorFlow Authors. ``` #@title Licensed under the Apache License, Version 2.0 # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
github_jupyter
# Text Generation ## Introduction Markov chains can be used for very basic text generation. Think about every word in a corpus as a state. We can make a simple assumption that the next word is only dependent on the previous word - which is the basic assumption of a Markov chain. Markov chains don't generate text as ...
github_jupyter
# Training with SageMaker Pipe Mode and TensorFlow using the SageMaker Python SDK SageMaker Pipe Mode is an input mechanism for SageMaker training containers based on Linux named pipes. SageMaker makes the data available to the training container using named pipes, which allows data to be downloaded from S3 to the con...
github_jupyter
# Project Report: bci4als #### Authors: Evyatar Luvaton, Noam Siegel This software was developed for the course Brain-Computer-Interface for ALS Patients, December 2020. Over the mid-semester project we have integrated the different parts of BCI which been discussed in the course. We introduce bci4als, a complete pip...
github_jupyter
<a href="https://colab.research.google.com/github/pablo-arantes/making-it-rain/blob/main/AlphaFold2%2BMD.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **Hello there!** This is a Jupyter notebook for running Molecular Dynamics (MD) simulations u...
github_jupyter
<a href="https://colab.research.google.com/github/arangoml/networkx-adapter/blob/doc_updates_nx/examples/batch_graph_pre_processing.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## Get Raw Data for Processing ``` %%capture !git clone -b doc_updat...
github_jupyter
``` info = { "title": "North Pole", "author": "Alex Carney", "github_username": "alcarney", "stylo_version": "0.9.0", "dimensions": (1920, 1080) } import numpy as np import numpy.random as npr from math import pi from stylo.domain.transform import translate from stylo.color import FillColor from stylo.shape impor...
github_jupyter
<a href="https://colab.research.google.com/github/OUCTheoryGroup/colab_demo/blob/master/Change_detection_PCA_KM.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ## 基于 PCA 和 K-Means 的SAR图像变化检测 T. Celik, Unsupervised Change Detection in Satellite Imag...
github_jupyter
``` import numpy as np import pandas as pd from vtk import * from vtk.util.numpy_support import vtk_to_numpy import matplotlib.pyplot as plt ``` ### Memory quad: 184 MB, lin: 132 MB ### Runtime quad: 24.9 s, lin: 8.4 s ``` plt.rcParams['legend.fontsize']=12 plt.rcParams['font.size'] = 14 #plt.rcParams['lines.linewidt...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from datareader import read_data, algs, display_ranks, combine_all_metrics ``` # Reading data ``` data, scores, test_users = read_data('Results for MovieLen', 'ML') all_metrics = combine_all_metrics(scores, data) all_me...
github_jupyter
``` import os import numpy as np import matplotlib.pyplot as plt ``` Computations performed in this notebook may take hours. Therefore, we have implemented notebook extension called `skip_cell` which could be used to omit certain cells. We defined global variables `IMPATIENCE` which should be set to `True` when you wa...
github_jupyter
# Self Organizing Map (SOM) Notebook ini berdasarkan kursus __Deep Learning A-Z™: Hands-On Artificial Neural Networks__ di Udemy. [Lihat Kursus](https://www.udemy.com/deeplearning/). ## Informasi Notebook - __notebook name__: `taruma_udemy_som` - __notebook version/date__: `1.0.1`/`20190729` - __notebook server__: Go...
github_jupyter
<table class="ee-notebook-buttons" align="left"><td> <a target="_blank" href="https://colab.research.google.com/github/giswqs/qgis-earthengine-examples/blob/master/Folium/export-ee-data.ipynb"> <img src="https://www.tensorflow.org/images/colab_logo_32px.png" /> Run in Google Colab</a> </td><td> <a target="_blank" ...
github_jupyter
``` # Scripts and doodles for getting Fortnite data. # Refactor to save to db and make calls daily or weekly. # External API calls commented out to prevent calls when viewed on GitHub. # All Fortnite data and rights belong to Epic Games. # Fortnite API - https://fortniteapi.com/ # Description of Fortnite Item Shop # h...
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...
github_jupyter
## Price Predictor ``` import pandas as pd import numpy as np housing = pd.read_csv("data.csv") housing.head() housing.info() housing.describe() housing['CRIM'] housing['CHAS'] housing['CHAS'].value_counts() %matplotlib inline import matplotlib as plt housing.hist(bins = 50, figsize=(20,15)) ``` ## Train-Test Splitti...
github_jupyter
# 旷视AI智慧交通开源赛道-交通标志识别 * 队伍:仙交小分队 * 初赛得分: 本次的比赛是交通标志检测,交通标志本身种类众多,大小不定,并且在交通复杂的十字路口场景下,由于光照、天气等因素的影响,使其被精确检测变得更加困难。通过反复实验,我们选择了今年旷视新出的YOLOX目标检测框架,megengine版本的yolox代码相对于pyotorch版本的bug较多,通过反复调试,我们最终的方案是:YOLOX_L + P6 + Focalloss + Inputsize2048 + 双线性插值上采样 + dataaug30,以下是整个调试的过程。 ## 数据分析 根据官方提供的示例代码,我们主要是在预训练的模型上面做微调。...
github_jupyter
``` # default_exp optimizer #export from fastai.torch_basics import * #hide from nbdev.showdoc import * ``` # Optimizer > Define the general fastai optimizer and the variants ## `_BaseOptimizer` - ``` #export class _BaseOptimizer(): "Common functionality between `Optimizer` and `OptimWrapper`" def all_param...
github_jupyter
# Pearson's Product-Moment Correlation In this tutorial, we explore - The theory behind the Pearson test statistic and p-value - The features of the implementation ## Theory The following description is adapted from [[1]](https://arxiv.org/abs/1907.02088): Pearson's product-moment correlation is a measure of the l...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns from IPython.display import Image ``` Chapter 7 n-step Bootstrapping ================= MC <-- n-step TD --> one-step TD ``` Image('./res/fig7_1.png') ``` Monte Carlo return: $G_t \doteq R_{t+1} + \gamma R_{t+2} + \gamma^2 R_{t+3} + \cdo...
github_jupyter
``` # This allows multiple outputs from a single jupyter notebook cell: from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" %matplotlib inline import pandas as pd ``` --- ## There will be three (or four) kwargs: - `hline=` ... specify one or a list of prices to ...
github_jupyter
``` import torch from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.optim.lr_scheduler import StepLR, MultiStepLR import numpy as np # import matplotlib.pyplot as plt from math import * import time torch.cuda.set_device(2) torch.set_default_t...
github_jupyter
## Dependencies ``` !pip install --quiet /kaggle/input/kerasapplications !pip install --quiet /kaggle/input/efficientnet-git import warnings, glob from tensorflow.keras import Sequential, Model import efficientnet.tfkeras as efn from cassava_scripts import * seed = 0 seed_everything(seed) warnings.filterwarnings('ig...
github_jupyter
# Working with Bag of Words ------------------------------------- In this example, we will download and preprocess the ham/spam text data. We will then use a one-hot-encoding to make a bag of words set of features to use in logistic regression. We will use these one-hot-vectors for logistic regression to predict if...
github_jupyter
### Sample code for Comparing NILM algorithms ``` from __future__ import print_function, division import time from matplotlib import rcParams import matplotlib.pyplot as plt import pandas as pd import numpy as np from six import iteritems %matplotlib inline rcParams['figure.figsize'] = (13, 6) from nilmtk import Da...
github_jupyter
# Collaboration and Competition --- You are welcome to use this coding environment to train your agent for the project. Follow the instructions below to get started! ### 1. Start the Environment Run the next code cell to install a few packages. This line will take a few minutes to run! ``` !pip -q install ./pyth...
github_jupyter
# Grid Search in REP This notebook demonstrates tools to optimize classification model provided by __Reproducible experiment platform (REP)__ package: * __grid search for the best classifier hyperparameters__ * __different optimization algorithms__ * __different scoring models__ (optimization of arbirtary figure o...
github_jupyter
# Styling *New in version 0.17.1* <span style="color: red">*Provisional: This is a new feature and still under development. We'll be adding features and possibly making breaking changes in future releases. We'd love to hear your feedback.*</span> This document is written as a Jupyter Notebook, and can be viewed or d...
github_jupyter
# Normalization ``` #load packages import pandas as pd import numpy as np from my_functions import * import pyRserve import os.path import gc from sklearn.experimental import enable_iterative_imputer from sklearn.impute import KNNImputer from sklearn.impute import SimpleImputer from sklearn.impute import IterativeImpu...
github_jupyter
# Lesson 8 ## 00:01:58 - What we've learned so far ### 00:02:14 - Differentiable programming * Should be called deep learning, should be called "differentiable programming". * "Stacks of differentiable non-linear functions with lots of parameters solve nearly any predictive modeling problem". * Can experiment wi...
github_jupyter
# Class Diagrams This is a simple viewer for class diagrams. Customized towards the book. **Prerequisites** * _Refer to earlier chapters as notebooks here, as here:_ [Earlier Chapter](Debugger.ipynb). ``` import bookutils ``` ## Synopsis <!-- Automatically generated. Do not edit. --> To [use the code provided in...
github_jupyter
# 3. Data Modelling: Systolic and Diastolic Failure Classification ``` # Import libraries import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import psycopg2 import getpass %matplotlib inline plt.style.use('ggplot') from sklearn.model_selection import train_test_split from sk...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import subprocess from IPython.display import clear_output title = "Gestorbene in Österreich nach Kalenderwoche" subtitle = "Quelle: Statistik Austria (Stand 23. Dezember 2021)" csv = pd.read_csv('https://data.statistik....
github_jupyter
``` from rdkit import Chem, DataStructs from rdkit.Chem import AllChem from rdkit.Chem import rdMolDescriptors as rdmd import pandas as pd from tqdm import tqdm import time import numpy as np from scipy.spatial.distance import cdist from sklearn.cluster import MiniBatchKMeans import matplotlib.pyplot as plt mito=pd.rea...
github_jupyter
<h2>CREAZIONE SERIE STORICHE DEI DECESSI COVID ACCERATI SU BASE REGIONALE IN BASE ALLA PERCENTUALE DELLA COPERTURA COMUNALE DEI DECESSI TOTALE ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd df = pd.read_csv('csv/decessi_covid19_regioni.csv') df.head() df.drop(['stato', 'codice_regione', 'l...
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
``` import argparse from typing import Dict import logging import torch from torch import optim from datasets import TemporalDataset from optimizers import TKBCOptimizer, IKBCOptimizer from models import ComplEx, TComplEx, TNTComplEx from regularizers import N3, Lambda3 import os os.environ["CUDA_DEVICE_ORDER"]="PCI_...
github_jupyter
# pyckmeans pyckmeans is a Python package for [Consensus K-Means](https://doi.org/10.1023/A:1023949509487) and [Weighted Ensemble Consensus of Random (WECR) K-Means](https://doi.org/10.1109/TKDE.2019.2952596) clustering, especially in the context of DNA sequence data. To evaluate the quality of clusterings, pyckmeans ...
github_jupyter
# Setup ## Imports ``` from tqdm import tqdm_notebook import gym ``` PyTorch modules ``` import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from vai.torch.utils import cuda ``` ## Define Useful Features ``` env = gym.make('Pong-ram-v...
github_jupyter
<a href="https://colab.research.google.com/github/manashpratim/Urban-Sound-Classification/blob/master/Urban_Sound_Classification.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` #Downloading the Datasets !wget --no-check-certificate \ "http...
github_jupyter
``` import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV, RandomizedSearchCV from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler,LabelEncoder from sklearn.ensemble import GradientBoostingRegressor, RandomForestRegre...
github_jupyter
``` import sys import os from pprint import pprint sys.path.append(os.path.abspath("../../../")) import warnings warnings.filterwarnings('ignore') from IPython.display import display, HTML from IPython.display import Markdown import ipywidgets as iw import numpy as np import pandas as pd import matplotlib.pyplot as plt...
github_jupyter
Hasta ahora, la forma en que hemos ido ejecutando las cosas ha sido total y completamente secuencial. Se ejecuta la linea 1, luego la 2, luego la 3... así hasta terminar la ejecución del programa. Pero usualmente queremos que ciertas piezas de código solamente se ejecuten si se dan ciertas condiciones, o que se ejecute...
github_jupyter
# Truncated Gaussians examples It is well known that the normal / Gaussian distribution is the distribution with maximum entropy subject to constraints on the first two moments. In this example we show the shapes of some distributions that arise when we place a bounds constraint in addition to constraints on the first...
github_jupyter
``` %matplotlib inline #%%writefile segmentation_3D_thirdversion.py from segmentation_functions import resample,grow from .finding_biggest_lung import arrange_slices, normalization, get_pixels_hu,creating_mask from seed_evaluation import evaluate_seed import scipy.ndimage.interpolation as inter import numpy as np impo...
github_jupyter
# Language Translation In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset of English and French sentences that can translate new sentences from English to French. ## Get the Data Since translating the whole lan...
github_jupyter
# 向量 > 有值和方向的量 假设在二维平面有一个点 x = 2, y = 1 \begin{equation}\vec{v} = \begin{bmatrix}2 \\ 1 \end{bmatrix}\end{equation} ``` from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "last_expr" # %matplotlib inline import math import numpy as np import matplotlib.pyplot as plt ...
github_jupyter
``` import torch import torch.nn.functional as F import torchsde import math import matplotlib.pyplot as plt import numpy as np from tqdm.notebook import tqdm from torch import _vmap_internals from cfollmer.objectives import log_g, relative_entropy_control_cost from cfollmer.sampler_utils import FollmerSDE, from c...
github_jupyter
``` import os, time import pandas as pd import numpy as np from tqdm import tqdm_notebook from selenium import webdriver as wd from selenium.webdriver.common.by import By train = pd.read_csv('../data/train.csv', usecols = ['id','latitude','longitude']) test = pd.read_csv('../data/test.csv', usecols = ['id','latitude',...
github_jupyter