text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Radial Velocity Orbit-fitting with RadVel ## Week 6, Intro-to-Astro 2021 ### Written by Ruben Santana & Sarah Blunt, 2018 #### Updated by Joey Murphy, June 2020 #### Updated by Corey Beard, July 2021 ## Background information Radial velocity measurements tell us how the velocity of a star changes along the directi...
github_jupyter
``` import math import string import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.special import logit from IPython.display import display import tensorflow as tf from tensorflow.keras.layers import (Input, Dense, Lambda, Flatten, Reshape, BatchNormalization, Layer, ...
github_jupyter
``` import pandas as pd import geopandas import glob import matplotlib.pyplot as plt import numpy as np import seaborn import shapefile as shp from paths import * from refuelplot import * setup() wpNZ = pd.read_csv(data_path + "/NZ/windparks_NZ.csv", delimiter=';') wpBRA = pd.read_csv(data_path + '/BRA/turbine_data.csv...
github_jupyter
# dwtls: Discrete Wavelet Transform LayerS This library provides downsampling (DS) layers using discrete wavelet transforms (DWTs), which we call DWT layers. Conventional DS layers lack either antialiasing filters and the perfect reconstruction property, so downsampled features are aliased and entire information of inp...
github_jupyter
<a href="https://colab.research.google.com/github/probml/pyprobml/blob/master/notebooks/sprinkler_pgm.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Directed graphical models We illustrate some basic properties of DGMs. ``` !pip install causal...
github_jupyter
``` import json from datetime import datetime, timedelta import matplotlib.pylab as plot import matplotlib.pyplot as plt from matplotlib import dates import pandas as pd import numpy as np import matplotlib matplotlib.style.use('ggplot') %matplotlib inline # Read data from http bro logs with open("http.log",'r') as in...
github_jupyter
# Method4 DCT based DOST + Huffman encoding ## Import Libraries ``` import mne import numpy as np from scipy.fft import fft,fftshift import matplotlib.pyplot as plt from scipy.signal import butter, lfilter from scipy.signal import freqz from scipy import signal from scipy.fftpack import fft, dct, idct from itertools ...
github_jupyter
# Quickstart In this tutorial, we explain how to quickly use ``LEGWORK`` to calculate the detectability of a collection of sources. ``` %matplotlib inline ``` Let's start by importing the source and visualisation modules of `LEGWORK` and some other common packages. ``` import legwork.source as source import legwork....
github_jupyter
``` from __future__ import division, print_function import os import torch import pandas import numpy as np from torch.utils.data import DataLoader,Dataset from torchvision import utils, transforms from skimage import io, transform import matplotlib.pyplot as plt import warnings #ignore warnings warnings.filterwarning...
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
``` #Fill the paths below PATH_FRC = "" # git repo directory path PATH_ZENODO = "" # Data and models are available here: https://zenodo.org/record/5831014#.YdnW_VjMLeo DATA_FLAT = PATH_ZENODO+'/data/goi_1000/flat_1000/*.png' DATA_NORMAL = PATH_ZENODO+'/data/goi_1000/standard_1000/*.jpg' GAUSS_L2_MODEL = PATH_ZENODO+'...
github_jupyter
``` import datetime import os, sys import numpy as np import matplotlib.pyplot as plt import casadi as cas import pickle import copy as cp # from ..</src> import car_plotting # from .import src.car_plotting PROJECT_PATH = '/home/nbuckman/Dropbox (MIT)/DRL/2020_01_cooperative_mpc/mpc-multiple-vehicles/' sys.path.appe...
github_jupyter
``` import ast from glob import glob import sys import os from copy import deepcopy import networkx as nx from stdlib_list import stdlib_list STDLIB = set(stdlib_list()) CONVERSIONS = { 'attr': 'attrs', 'PIL': 'Pillow', 'Image': 'Pillow', 'mpl_toolkits': 'matplotlib', 'dateutil': 'python-dateutil...
github_jupyter
``` import pandas as pd import numpy as np %matplotlib inline import joblib import json import tqdm import glob import numba import dask import xgboost from dask.diagnostics import ProgressBar import re ProgressBar().register() fold1, fold2 = joblib.load("./valid/fold1.pkl.z"), joblib.load("./valid/fold2.pkl.z") tra...
github_jupyter
``` from imports import * import pickle # device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') device = torch.device("cuda:0") 2048*6*10 def get_encoder(model_name): if model_name == 'mobile_net': md = torchvision.models.mobilenet_v2(pretrained=True) encoder = nn.Seq...
github_jupyter
# Write custom inference script and requirements to local folder ``` ! mkdir inference_code %%writefile inference_code/inference.py # This is the script that will be used in the inference container import os import json import torch from transformers import AutoModelForSeq2SeqLM, AutoTokenizer def model_fn(model_d...
github_jupyter
# Ejercicio: Spectral clustering para documentos El clustering espectral es una técnica de agrupamiento basada en la topología de gráficas. Es especialmente útil cuando los datos no son convexos o cuando se trabaja, directamente, con estructuras de grafos. ##Preparación d elos documentos Trabajaremos con documentos ...
github_jupyter
``` # Copyright 2020 IITK EE604A Image Processing. All Rights Reserved. # # Licensed under the MIT License. Use and/or modification of this code outside of EE604 must reference: # # © IITK EE604A Image Processing # https://github.com/ee604/ee604_assignments # # Author: Shashi Kant Gupta, Chiranjeev Prachand and Prof ...
github_jupyter
``` # super comms script import serial from time import sleep import math from tqdm import * import json def set_target(motor, location, ser, output=True): if ser.is_open: if motor =='A': ser.write(b'A') else: ser.write(b'B') target_bytes = location.to_bytes...
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/classification-credit-card-fraud/auto-ml-classification-credit-card-fraud....
github_jupyter
``` import json import os from pprint import * from tqdm import * from utils.definitions import ROOT_DIR path_load = "mpd.v1/data/" #json folder path_save = ROOT_DIR + "/data/original/" #where to save csv playlist_fields = ['pid','name', 'collaborative', 'modified_at', 'num_albums', 'num_tracks', 'num_followers', 'num_...
github_jupyter
# This Jupyter Notebook contains the full code needed to write the ColumnTransformer blog ## Import Necessary Packages ``` import pandas as pd import numpy as np from sklearn.compose import ColumnTransformer from sklearn.preprocessing import StandardScaler, OneHotEncoder from sklearn.model_selection import train_test...
github_jupyter
<img src="http://hilpisch.com/tpq_logo.png" alt="The Python Quants" width="35%" align="right" border="0"><br> # Python for Finance **Analyze Big Financial Data** O'Reilly (2014) Yves Hilpisch <img style="border:0px solid grey;" src="http://hilpisch.com/python_for_finance.png" alt="Python for Finance" width="30%" a...
github_jupyter
# 第6章 スモール言語を作る ``` # !pip install pegtree import pegtree as pg from pegtree.colab import peg, pegtree, example %%peg Program = { // 開式非終端記号 Expression* #Program } EOF EOF = !. // ファイル終端 Expression = / FuncDecl // 関数定義 / VarDecl // 変数定義 / IfExpr // if 式 / Binary // 二項演算 ``` import pegtree as ...
github_jupyter
## Dataset https://data.wprdc.org/dataset/allegheny-county-restaurant-food-facility-inspection-violations/resource/112a3821-334d-4f3f-ab40-4de1220b1a0a This data set is a set of all of the restaurants in Allegheny County with geographic locations including zip code, size, description of use, and a "status" ranging fro...
github_jupyter
# Dimensionality Reduction Example Using the IMDB data, feature matrix and apply dimensionality reduction to this matrix via PCA and SVD. ``` %matplotlib inline import json import random import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.sparse import lil_matrix from sklearn.neighbor...
github_jupyter
## Image segmentation with CamVid ``` %reload_ext autoreload %autoreload 2 %matplotlib inline from fastai import * from fastai.vision import * from fastai.callbacks.hooks import * ``` The One Hundred Layer Tiramisu paper used a modified version of Camvid, with smaller images and few classes. You can get it from the C...
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
# Equilibrium analysis Chemical reaction Number (code) of assignment: 2N4 Description of activity: Report on behalf of: name : Pieter van Halem student number : 4597591 name : Dennis Dane student number :4592239 Data of student taking the role of contact person: name : email address : ``` import numpy as n...
github_jupyter
# Creating a simple PDE model In the [previous notebook](./1-an-ode-model.ipynb) we show how to create, discretise and solve an ODE model in pybamm. In this notebook we show how to create and solve a PDE problem, which will require meshing of the spatial domain. As an example, we consider the problem of linear diffus...
github_jupyter
# Writing Functions This lecture discusses the mechanics of writing functions and how to encapsulate scripts as functions. ``` # Example: We're going to use Pandas dataframes to create a gradebook for this course import pandas as pd # Student Rosters: students = ['Hao', 'Jennifer', 'Alex'] # Gradebook columns: col...
github_jupyter
# 线性回归 :label:`sec_linear_regression` *回归*(regression)是能为一个或多个自变量与因变量之间关系建模的一类方法。 在自然科学和社会科学领域,回归经常用来表示输入和输出之间的关系。 在机器学习领域中的大多数任务通常都与*预测*(prediction)有关。 当我们想预测一个数值时,就会涉及到回归问题。 常见的例子包括:预测价格(房屋、股票等)、预测住院时间(针对住院病人等)、 预测需求(零售销量等)。 但不是所有的*预测*都是回归问题。 在后面的章节中,我们将介绍分类问题。分类问题的目标是预测数据属于一组类别中的哪一个。 ## 线性回归的基本元素 *线性回归*(linear r...
github_jupyter
## Load Model, plain 2D Conv ``` import os os.chdir("../..") os.getcwd() import numpy as np import torch import json from distributed.model_util import choose_model, choose_old_model, load_model, extend_model_config from distributed.util import q_value_index_to_action import matplotlib.pyplot as plt model_name = "conv...
github_jupyter
``` ls ../test-data/ %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import tables as tb import h5py import dask.dataframe as dd import dask.bag as db import blaze fname = '../test-data/EQY_US_ALL_BBO_201402/EQY_US_ALL_BBO_20140206.h5' max_sym = '/SPY/no_suffix' fname = '../tes...
github_jupyter
**Copyright 2021 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 ag...
github_jupyter
# Testing cnn for classifying universes Nov 10, 2020 ``` import argparse import os import random import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim as optim import torch.utils.data from torchsummary import summary from torch.utils.data import DataLoade...
github_jupyter
#### Abstract Classes: contains abstract methods Abstract methods are those which are only declared but they've no implementation **All methods need to be implemented (mandatory) Module -- abc | | |---> ABC (Class) | |---> Abstract method ...
github_jupyter
``` # This mounts your Google Drive to the Colab VM. from google.colab import drive drive.mount('/content/drive') # TODO: Enter the foldername in your Drive where you have saved the unzipped # assignment folder, e.g. 'cs231n/assignments/assignment1/' FOLDERNAME = None assert FOLDERNAME is not None, "[!] Enter the fold...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Libraries-and-functions" data-toc-modified-id="Libraries-and-functions-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Libraries and functions</a></span><ul class="toc-item"><li><span><a href="#Import-lib...
github_jupyter
# Segmentation Image segmentation is another early as well as an important image processing task. Segmentation is the process of breaking an image into groups, based on similarities of the pixels. Pixels can be similar to each other in multiple ways like brightness, color, or texture. The segmentation algorithms are t...
github_jupyter
# Results Analysis This notebook analyzes results produced by the _anti-entropy reinforcement learning_ experiments. The practical purpose of this notebook is to create graphs that can be used to display anti-entropy topologies, but also to extract information relevant to each experimental run. ``` %matplotlib noteb...
github_jupyter
``` # reload packages %load_ext autoreload %autoreload 2 ``` ### Choose GPU (this may not be needed on your computer) ``` %env CUDA_DEVICE_ORDER=PCI_BUS_ID %env CUDA_VISIBLE_DEVICES=1 import tensorflow as tf gpu_devices = tf.config.experimental.list_physical_devices('GPU') if len(gpu_devices)>0: tf.config.experim...
github_jupyter
# **Space X Falcon 9 First Stage Landing Prediction** ## Web scraping Falcon 9 and Falcon Heavy Launches Records from Wikipedia We will be performing web scraping to collect Falcon 9 historical launch records from a Wikipedia page titled `List of Falcon 9 and Falcon Heavy launches` [https://en.wikipedia.org/wiki/Li...
github_jupyter
``` import pandas as pd import numpy as np import sys from sklearn.preprocessing import LabelEncoder,OneHotEncoder from sklearn.feature_selection import RFE from sklearn.tree import DecisionTreeClassifier from sklearn import preprocessing col_names = ["duration","protocol_type","service","flag","src_bytes", "dst_by...
github_jupyter
Branching GP Regression on hematopoietic data -- *Alexis Boukouvalas, 2017* **Note:** this notebook is automatically generated by [Jupytext](https://jupytext.readthedocs.io/en/latest/index.html), see the README for instructions on working with it. test change Branching GP regression with Gaussian noise on the hemat...
github_jupyter
``` %matplotlib inline import itertools import os os.environ['CUDA_VISIBLE_DEVICES']="" import numpy as np import gpflow import gpflow.training.monitor as mon import numbers import matplotlib.pyplot as plt import tensorflow as tf ``` # Demo: `gpflow.training.monitor` In this notebook we'll demo how to use `gpflow.trai...
github_jupyter
<img width="10%" alt="Naas" src="https://landen.imgix.net/jtci2pxwjczr/assets/5ice39g4.png?w=160"/> # IUCN - Extinct species <a href="https://app.naas.ai/user-redirect/naas/downloader?url=https://raw.githubusercontent.com/jupyter-naas/awesome-notebooks/master/IUCN/IUCN_Extinct_species.ipynb" target="_parent"><img src=...
github_jupyter
# ThaiNER (Bi-LSTM CRF) using pytorch By Mr.Wannaphong Phatthiyaphaibun Bachelor of Science Program in Computer and Information Science, Nong Khai Campus, Khon Kaen University https://iam.wannaphong.com/ E-mail : wannaphong@kkumail.com Thank you Faculty of Applied Science and Engineering, Nong Khai Campus, Khon K...
github_jupyter
# Flight Price Prediction --- ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set() pip list ``` ## Importing dataset 1. Check whether any null values are there or not. if it is present then following can be done, 1. Imputing data using Imputation method in s...
github_jupyter
<h1><center>Solving Linear Equations with Quantum Circuits</center></h1> <h2><center>Ax = b</center></h2> <h4><center> Attempt to replicate the following paper </center></h4> ![image.png](attachment:image.png) <h3><center>Algorithm for a simpler 2 x 2 example</center></h3> ![image.png](attachment:image.png) ![imag...
github_jupyter
``` from mocpy import MOC import numpy as np from astropy import units as u from astropy.coordinates import SkyCoord %matplotlib inline # Plot the polygon vertices on a matplotlib axis def plot_graph(vertices): import matplotlib.pyplot as plt from matplotlib import path, patches fig = plt.figure() ...
github_jupyter
# MCMC sampling using the emcee package ## Introduction The goal of Markov Chain Monte Carlo (MCMC) algorithms is to approximate the posterior distribution of your model parameters by random sampling in a probabilistic space. For most readers this sentence was probably not very helpful so here we'll start straight wi...
github_jupyter
#Stock Price Predictor This is a Jupyter notebook that you can use to get prediction of adjusted close stock price per the specified day range after the last day from the training data set. The prediction is made by training the machine learning model with historical trade of the stock data. This is the result of stud...
github_jupyter
<a href="https://qworld.net" target="_blank" align="left"><img src="../qworld/images/header.jpg" align="left"></a> $ \newcommand{\bra}[1]{\langle #1|} $ $ \newcommand{\ket}[1]{|#1\rangle} $ $ \newcommand{\braket}[2]{\langle #1|#2\rangle} $ $ \newcommand{\dot}[2]{ #1 \cdot #2} $ $ \newcommand{\biginner}[2]{\left\langle...
github_jupyter
``` import os import struct import pandas as pd import numpy as np import talib as tdx def readTdxLdayFile(fname="data/sh000001.day"): dataSet=[] with open(fname,'rb') as fl: buffer=fl.read() #读取数据到缓存 size=len(buffer) rowSize=32 #通信达day数据,每32个字节一组数据 code=os.path.basename(fname).replace('.day','') ...
github_jupyter
``` import argparse import torch.distributed as dist import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler import test # import test.py to get mAP after each epoch from models import * from utils.datasets import * from utils.utils import * from mymodel import * # Hyperparameters (results68: 5...
github_jupyter
``` #hide %load_ext autoreload %autoreload 2 # default_exp analysis ``` # Analysis > The analysis functions help a modeler quickly run a full time series analysis. An analysis consists of: 1. Initializing a DGLM, using `define_dglm`. 2. Updating the model coefficients at each time step, using `dglm.update`. 3. Fore...
github_jupyter
# Support Vector Machines Support Vector Machines (SVM) are an extension of the linear methods that attempt to separate classes with hyperplans. These extensions come in three steps: 1. When classes are linearly separable, maximize the margin between the two classes 2. When classes are not linearly separable, maximiz...
github_jupyter
``` import caffe import numpy as np import matplotlib.pyplot as plt import os from keras.datasets import mnist from caffe.proto import caffe_pb2 import google.protobuf.text_format plt.rcParams['image.cmap'] = 'gray' %matplotlib inline ``` Loading the model ``` model_def = 'example_caffe_mnist_model.prototxt' model_we...
github_jupyter
# Transpose convolution: Upsampling In section 10.5.3, we discussed how transpose convolutions are can be used to upsample a lower resolution input into a higher resolution output. This notebook contains fully functional PyTorch code for the same. ``` import matplotlib.pyplot as plt import torch import math ``` Firs...
github_jupyter
``` import tensorflow as tf print(tf.__version__) import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras def plot_series(time, series, format="-", start=0, end=None): plt.plot(time[start:end], series[start:end], format) plt.xlabel("Time") plt.ylabel("Value")...
github_jupyter
# Genentech Cervical Cancer - Feature Selection https://www.kaggle.com/c/cervical-cancer-screening/ ``` # imports import sys # for stderr import numpy as np import pandas as pd import sklearn as skl from sklearn import metrics import matplotlib.pyplot as plt %matplotlib inline # settings %logstop %logstart -o 'cc_f...
github_jupyter
``` import nltk import difflib import time import gc import itertools import multiprocessing import pandas as pd import numpy as np import xgboost as xgb import lightgbm as lgb import warnings warnings.filterwarnings('ignore') import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns from sklearn.metri...
github_jupyter
# Homework 1 The maximum score of this homework is 100+10 points. Grading is listed in this table: | Grade | Score range | | --- | --- | | 5 | 85+ | | 4 | 70-84 | | 3 | 55-69 | | 2 | 40-54 | | 1 | 0-39 | Most exercises include tests which should pass if your solution is correct. However successful test do not guaran...
github_jupyter
# Optimiztion with `mystic` ``` %matplotlib notebook ``` `mystic`: approximates that `scipy.optimize` interface ``` """ Example: - Minimize Rosenbrock's Function with Nelder-Mead. - Plot of parameter convergence to function minimum. Demonstrates: - standard models - minimal solver interface - pa...
github_jupyter
``` # Load dependencies import numpy as np import pandas as pd from uncertainties import ufloat from uncertainties import unumpy ``` # Biomass C content estimation Biomass is presented in the paper on a dry-weight basis. As part of the biomass calculation, we converted biomass in carbon-weight basis to dry-weight ba...
github_jupyter
# Introduction <div class="alert alert-info"> **Code not tidied, but should work OK** </div> <img src="../Udacity_DL_Nanodegree/031%20RNN%20Super%20Basics/SimpleRNN01.png" align="left"/> # Neural Network ``` import numpy as np import matplotlib.pyplot as plt import pdb ``` **Sigmoid** ``` def sigmoid(x): re...
github_jupyter
<a id="title_ID"></a> # JWST Pipeline Validation Notebook: calwebb_detector1, dark_current unit tests <span style="color:red"> **Instruments Affected**</span>: NIRCam, NIRISS, NIRSpec, MIRI, FGS ### Table of Contents <div style="text-align: left"> <br> [Introduction](#intro) <br> [JWST Unit Tests](#unit) <br> ...
github_jupyter
## Dự án 01: Xây dựng Raspberry PI thành máy tính cho Data Scientist (PIDS) ## Bài 01. Cài đặt TensorFlow và các thư viện cần thiết ##### Người soạn: Dương Trần Hà Phương ##### Website: [Mechasolution Việt Nam](https://mechasolution.vn) ##### Email: mechasolutionvietnam@gmail.com --- ## 1. Mở đầu Nếu bạn muốn chạy mộ...
github_jupyter
# House Price Prediction With TensorFlow [![open_in_colab][colab_badge]][colab_notebook_link] [![open_in_binder][binder_badge]][binder_notebook_link] [colab_badge]: https://colab.research.google.com/assets/colab-badge.svg [colab_notebook_link]: https://colab.research.google.com/github/UnfoldedInc/examples/blob/master...
github_jupyter
# Semantic Image Clustering **Author:** [Khalid Salama](https://www.linkedin.com/in/khalid-salama-24403144/)<br> **Date created:** 2021/02/28<br> **Last modified:** 2021/02/28<br> **Description:** Semantic Clustering by Adopting Nearest neighbors (SCAN) algorithm. ## Introduction This example demonstrates how to app...
github_jupyter
``` import json import numpy as np from sklearn.model_selection import train_test_split import tensorflow.keras as keras import matplotlib.pyplot as plt import random import librosa import math # path to json data_path = "C:\\Users\\Saad\\Desktop\\Project\\MGC\\Data\\data.json" def load_data(data_path): with ope...
github_jupyter
# Notebook 3 - Advanced Data Structures So far, we have seen numbers, strings, and lists. In this notebook, we will learn three more data structures, which allow us to organize data. The data structures are `tuple`, `set`, and `dict` (dictionary). ## Tuples A tuple is like a list, but is immutable, meaning that it ca...
github_jupyter
### Mount Google Drive (Works only on Google Colab) ``` from google.colab import drive drive.mount('/content/gdrive') ``` # Import Packages ``` import os import numpy as np import pandas as pd from zipfile import ZipFile from PIL import Image from tqdm.autonotebook import tqdm from IPython.display import display fr...
github_jupyter
<a id='pd'></a> <div id="qe-notebook-header" align="right" style="text-align:right;"> <a href="https://quantecon.org/" title="quantecon.org"> <img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon"> </a> </div> #...
github_jupyter
# In this note book the following steps are taken: 1. Remove highly correlated attributes 2. Find the best hyper parameters for estimator 3. Find the most important features by tunned random forest 4. Find f1 score of the tunned full model 5. Find best hyper parameter of model with selected features 6. Find f1 score of...
github_jupyter
# Anailís ghramadaí trí [deplacy](https://koichiyasuoka.github.io/deplacy/) ## le [Stanza](https://stanfordnlp.github.io/stanza) ``` !pip install deplacy stanza import stanza stanza.download("ga") nlp=stanza.Pipeline("ga") doc=nlp("Táimid faoi dhraíocht ag ceol na farraige.") import deplacy deplacy.render(doc) deplac...
github_jupyter
<a href="https://colab.research.google.com/github/open-mmlab/mmclassification/blob/master/docs/tutorials/MMClassification_python.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # MMClassification Python API tutorial on Colab In this tutorial, we wi...
github_jupyter
``` ``` # **Deep Convolutional Generative Adversarial Network (DC-GAN):** DC-GAN is a foundational adversarial framework developed in 2015. It had a major contribution in streamlining the process of designing adversarial frameworks and visualizing intermediate representations, thus, making GANs more accessible to b...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt from functools import reduce import seaborn as sns; sns.set(rc={'figure.figsize':(15,15)}) import numpy as np import pandas as pd from sqlalchemy import create_engine from sklearn.preprocessing import MinMaxScaler engine = create_engine('postgresql://postgres:mimi...
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 in import numpy as np # linear algebra import pandas as pd # data processing, CSV file...
github_jupyter
``` from pykat import finesse from pykat.commands import * import numpy as np import matplotlib.pyplot as plt import scipy from IPython import display pykat.init_pykat_plotting(dpi=200) base1 = """ l L0 10 0 n0 #input laser ...
github_jupyter
# Web crawling exercise ``` from selenium import webdriver ``` ## Quiz 1 - 아래 URL의 NBA 데이터를 크롤링하여 판다스 데이터 프레임으로 나타내세요. - http://stats.nba.com/teams/traditional/?sort=GP&dir=-1 ### 1.1 webdriver를 실행하고 사이트에 접속하기 ``` driver = webdriver.Chrome() url = "http://stats.nba.com/teams/traditional/?sort=GP&dir=-1" driver.get(...
github_jupyter
# Custom Building Recurrent Neural Network **Notation**: - Superscript $[l]$ denotes an object associated with the $l^{th}$ layer. - Superscript $(i)$ denotes an object associated with the $i^{th}$ example. - Superscript $\langle t \rangle$ denotes an object at the $t^{th}$ time-step. - **Sub**script $i$ den...
github_jupyter
# Data description: I'm going to solve the International Airline Passengers prediction problem. This is a problem where given a year and a month, the task is to predict the number of international airline passengers in units of 1,000. The data ranges from January 1949 to December 1960 or 12 years, with 144 observation...
github_jupyter
# Comparing soundings from NCEP Reanalysis and various models We are going to plot the global, annual mean sounding (vertical temperature profile) from observations. Read in the necessary NCEP reanalysis data from the online server. The catalog is here: <https://psl.noaa.gov/psd/thredds/catalog/Datasets/ncep.reanaly...
github_jupyter
# `numpy` မင်္ဂလာပါ၊ welcome to the week 07 of Data Science Using Python. We will go into details of `numpy` this week (as well as do some linear algebra stuffs). ## `numpy` အကြောင်း သိပြီးသမျှ * `numpy` ဟာ array library ဖြစ်တယ်၊ * efficient ဖြစ်တယ်၊ * vector နဲ့ matrix တွေကို လွယ်လွယ်ကူကူ ကိုင်တွယ်နိုင်တယ...
github_jupyter
``` import pandas as pd import datetime from finquant.portfolio import build_portfolio from finquant.moving_average import compute_ma, ema from finquant.moving_average import plot_bollinger_band from finquant.efficient_frontier import EfficientFrontier ### DOES OUR OPTIMIZATION ACTUALLY WORK? # COMPARING AN OPTIMIZED ...
github_jupyter
# Isolation Forest (IF) outlier detector deployment Wrap a scikit-learn Isolation Forest python model for use as a prediction microservice in seldon-core and deploy on seldon-core running on minikube or a Kubernetes cluster using GCP. ## Dependencies - [helm](https://github.com/helm/helm) - [minikube](https://github...
github_jupyter
``` from IPython.display import Latex # Latex(r"""\begin{eqnarray} \large # Z_{n+1} = Z_{n}^(-e^(Z_{n}^p)^(e^(Z_{n}^p)^(-e^(Z_{n}^p)^(e^(Z_{n}^p)^(-e^(Z_{n}^p)))))) # \end{eqnarray}""") ``` # Parameterized machine learning algo: ## tanh(Z) = (a exp(Z) - b exp(-Z)) / (c exp(Z) + d exp(-Z)) ### with parameters a,b,c,...
github_jupyter
# Hashtags ``` from nltk.tokenize import TweetTokenizer import os import pandas as pd import re import sys from sklearn.feature_extraction.text import CountVectorizer from sklearn.decomposition import LatentDirichletAllocation from IPython.display import clear_output def squeal(text=None): clear_output(wait=True) ...
github_jupyter
# Graph > in progress - toc: true - badges: true - comments: true - categories: [self-taught] - image: images/bone.jpeg - hide: true https://towardsdatascience.com/using-graph-convolutional-neural-networks-on-structured-documents-for-information-extraction-c1088dcd2b8f CNNs effectively capture patterns in data in Eu...
github_jupyter
# 08 - Common problems & bad data situations <a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" title='This work is licensed under a Creative Commons Attribution 4.0 International License....
github_jupyter
``` import tensorflow as tf import tensorflow as tf from tensorflow.python.keras.applications.vgg19 import VGG19 model=VGG19( include_top=False, weights='imagenet' ) model.trainable=False model.summary() from tensorflow.python.keras.preprocessing.image import load_img, img_to_array from tensorflow.python.keras....
github_jupyter
``` %reload_ext watermark %matplotlib inline from os.path import exists from metapool.metapool import * from metapool import (validate_plate_metadata, assign_emp_index, make_sample_sheet, KLSampleSheet, parse_prep, validate_and_scrub_sample_sheet, generate_qiita_prep_file) %watermark -i -v -iv -m -h -p metapool,sample...
github_jupyter
<img src="../../images/banners/python-basics.png" width="600"/> # <img src="../../images/logos/python.png" width="23"/> Conda Environments ## <img src="../../images/logos/toc.png" width="20"/> Table of Contents * [Understanding Conda Environments](#understanding_conda_environments) * [Understanding Basic Package Man...
github_jupyter
# Configuraciones para el Grupo de Estudio <img src="./img/f_mail.png" style="width: 700px;"/> ## Contenidos - ¿Por qué jupyter notebooks? - Bash - ¿Que es un *kernel*? - Instalación - Deberes ## Python y proyecto Jupyter <img src="./img/py.jpg" style="width: 500px;"/> <img src="./img/jp.png" style="width: 100px;"/...
github_jupyter
# MHKiT Quality Control Module The following example runs a simple quality control analysis on wave elevation data using the [MHKiT QC module](https://mhkit-software.github.io/MHKiT/mhkit-python/api.qc.html). The data file used in this example is stored in the [\\\\MHKiT\\\\examples\\\\data](https://github.com/MHKiT-S...
github_jupyter
``` import tushare as ts import sina_data import numpy as np import pandas as pd from pandas import DataFrame, Series from datetime import datetime, timedelta from dateutil.parser import parse import time import common_util import os def get_time(date=False, utc=False, msl=3): if date: time_fmt = "%Y-%m-%d ...
github_jupyter
``` %matplotlib inline %pylab inline pylab.rcParams['figure.figsize'] = (10, 6) import numpy as np from numpy.lib import stride_tricks import cv2 from matplotlib.colors import hsv_to_rgb import matplotlib.pyplot as plt import numpy as np np.set_printoptions(precision=3) class PatchMatch(object): def __init__(self, ...
github_jupyter