code
stringlengths
2.5k
150k
kind
stringclasses
1 value
# Example 2: mouse blood lineage networks A pipeline providing an example of ShareNet's usage on a mouse blood lineage dataset is included in the ```~/sharenet/example2``` subdirectory. Here, we go through the different steps associated with this pipeline. ``` %matplotlib inline import os import numpy as np import mat...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import astropy.units as u from astropy.time import Time import pytz import astropy from astropy.coordinates import SkyCoord from astroplan import Observer, FixedTarget, observability_table, Constraint from astropy.coordinates ...
github_jupyter
*本文讲解了概率编程的基本模块* - 随机函数是某个数据生成过程的模型 - 初等随机函数就是一类可以显式计算样本概率的随机函数 核心问题: - 样本是有名字的,如何获得样本的名字?如何使用样本的名字? # An Introduction to Models in Pyro The basic unit of probabilistic programs is the _stochastic function_. This is an arbitrary Python callable that combines two ingredients: - deterministic Python code; and - pri...
github_jupyter
``` """ You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab. Instructions for setting up Colab are as follows: 1. Open a new Python 3 notebook. 2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL) 3. Connect to an in...
github_jupyter
# Nearest neighbors This notebook illustrates the classification of the nodes of a graph by the [k-nearest neighbors algorithm](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm), based on the labels of a few nodes. ``` from IPython.display import SVG import numpy as np from sknetwork.data import karate_clu...
github_jupyter
``` import pandas as pd from matplotlib.ticker import FuncFormatter from Cohort import CohortTable import numpy as np import altair as alt import math from IPython.display import display, Markdown # Pulled from class module; need to remove self references def print_all_tables(self): display(Markdown('## Product...
github_jupyter
# WorkFlow ## Classes ## Load the data ## Test Modelling ## Modelling **<hr>** ## Classes ``` NAME = "change the conv2d" BATCH_SIZE = 32 import os import cv2 import torch import numpy as np def load_data(img_size=112): data = [] index = -1 labels = {} for directory in os.listdir('./data/'): ...
github_jupyter
``` %load_ext autoreload %reload_ext autoreload %autoreload 2 %matplotlib inline import os # TO USE A DATABASE OTHER THAN SQLITE, USE THIS LINE # Note that this is necessary for parallel execution amongst other things... # os.environ['SNORKELDB'] = 'postgres:///snorkel-intro' from snorkel import SnorkelSession sessi...
github_jupyter
# Modes of a Vibrating Building In this notebook we will find the vibrational modes of a simple model of a building. We will assume that the mass of the floors are much more than the mass of the walls and that the lateral stiffness of the walls can be modeled by a simple linear spring. We will investigate how the buil...
github_jupyter
<a href="https://colab.research.google.com/github/LyaSolis/exBERT/blob/master/1_data_prep.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` from google.colab import drive drive.mount('/content/drive') !ls /content/drive/MyDrive/GitHub/bluebert ```...
github_jupyter
<a href="https://colab.research.google.com/github/nakanoelio/i2a2-challenge-petr4-trad-sys/blob/main/I2A2_PETR4_Multinomial_Naive_Bayes_%2B_ARIMA_Trading_System.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> ``` !pip install yfinance !pip install -...
github_jupyter
# Bổ trợ bài giảng về Đại số tuyến tính - Phần 1 ## MaSSP 2018, Computer Science Tài liệu ngắn này đưa ra định nghĩa một số khái niệm cơ bản trong đại số tuyến tính liên quan đến vector và ma trận. # 1. Một số khái niệm ## 1.1. Vô hướng (Scalar) Một `scalar` là một số bất kì thuộc tập số nào đó. Khi định nghĩa một số ...
github_jupyter
``` from pydrive.auth import GoogleAuth from pydrive.drive import GoogleDrive from google.colab import auth from oauth2client.client import GoogleCredentials auth.authenticate_user() gauth = GoogleAuth() gauth.credentials = GoogleCredentials.get_application_default() drive = GoogleDrive(gauth) from google.colab import...
github_jupyter
<!-- dom:TITLE: Week 2 January 11-15: Introduction to the course and start Variational Monte Carlo --> # Week 2 January 11-15: Introduction to the course and start Variational Monte Carlo <!-- dom:AUTHOR: Morten Hjorth-Jensen Email morten.hjorth-jensen@fys.uio.no at Department of Physics and Center fo Computing in Sci...
github_jupyter
# Домашнее задание «Доверительные интервалы. Статистическая проверка гипотез для несвязанных выборок» ``` import scipy.stats as stats import pandas as pd import numpy as np import scipy as sp ``` 1. Найдите минимально необходимый объем выборки для построения интервальной оценки среднего с точностью ∆ = 3, дисперсией ...
github_jupyter
``` from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer import string import gensim from gensim import corpora import nltk nltk.download('stopwords') nltk.download('wordnet') from nltk.corpus import stopwords from nltk.stem.wordnet import WordNetLemmatizer import string import gensim fro...
github_jupyter
``` %matplotlib inline from pyvista import set_plot_theme set_plot_theme('document') ``` Customize Scalar Bars {#scalar_bar_example} ===================== Walk through of all the different capabilities of scalar bars and how a user can customize scalar bars. ``` # sphinx_gallery_thumbnail_number = 2 import pyvista a...
github_jupyter
## Step 1: Import Libraries ``` # All imports import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import missingno import seaborn as sns from sklearn.feature_selection import SelectKBest, f_regression from sklearn.model_selection import train_test_split from sklearn.preprocessing import ...
github_jupyter
``` # Copyright 2022 Google LLC # # 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 agreed to in writi...
github_jupyter
``` #hide #skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #default_exp data.transforms #export from fastai.torch_basics import * from fastai.data.core import * from fastai.data.load import * from fastai.data.external import * from sklearn.model_selection import train_test_split #hide from...
github_jupyter
![JohnSnowLabs](https://nlp.johnsnowlabs.com/assets/images/logo.png) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JohnSnowLabs/nlu/blob/master/examples/webinars_conferences_etc/multi_lingual_webinar/4_Unsupervise_Chinese_Keyword_Extraction_NER_an...
github_jupyter
# Simple Scatter Plots Another commonly used plot type is the simple scatter plot, a close cousin of the line plot. Instead of points being joined by line segments, here the points are represented individually with a dot, circle, or other shape. We’ll start by setting up the notebook for plotting and importing the fun...
github_jupyter
``` import numpy as np import pandas as pd df=pd.read_csv('houseprice.csv',usecols=["SalePrice","MSSubClass","MSZoning","LotFrontage","LotArea", "Street","YearBuilt","LotShape","1stFlrSF","2ndFlrSF"]).dropna() df.shape df.head() df.info() for i in df.columns: print("Column na...
github_jupyter
# 📃 Solution for Exercise M1.04 The goal of this exercise is to evaluate the impact of using an arbitrary integer encoding for categorical variables along with a linear classification model such as Logistic Regression. To do so, let's try to use `OrdinalEncoder` to preprocess the categorical variables. This preproce...
github_jupyter
``` #@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 agreed to in writing, software # distributed u...
github_jupyter
# Clean and Analyze Employee Exit Surveys In this project, we'll clean and analyze exit surveys from employees of the Department of Education, Training and Employment (DETE)}) and the Technical and Further Education (TAFE) body of the Queensland government in Australia. The TAFE exit survey can be found here and the su...
github_jupyter
# Lec 11. Simple CNN : 한글 자모 ``` import torch import torch.nn as nn import torch.optim as optim import torch.nn.init as init import torch.utils.data as Data import torchvision.utils as utils import torchvision.datasets as dsets import torchvision.transforms as transforms import numpy as np import os from PIL import ...
github_jupyter
## Face and Facial Keypoint detection After you've trained a neural network to detect facial keypoints, you can then apply this network to *any* image that includes faces. The neural network expects a Tensor of a certain size as input and, so, to detect any face, you'll first have to do some pre-processing. 1. Detect...
github_jupyter
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import gzip #loading the data from the given file image_size = 28 num_images = 55000 f = gzip.open('train-images-idx3-ubyte.gz','r') f.read(16) buf = f.read(image_size * image_size * num_images) data = np.frombuffer(buf, dtype=np.uint8).astype...
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
# NumPy Numpy is the core library for scientific computing in Python. <br/> It provides a high-performance multidimensional array object, and tools for working with these arrays. <br/> Official NumPy Documentation: https://numpy.org/doc/stable/reference/ ``` # Install NumPy # ! pip install numpy ``` Since NumPy is n...
github_jupyter
# Backtest Orbit Model In this section, we will cover: - How to create a TimeSeriesSplitter - How to create a BackTester and retrieve the backtesting results - How to leverage the backtesting to tune the hyper-paramters for orbit models ``` %matplotlib inline import pandas as pd import numpy as np import matplotlib...
github_jupyter
# Gemetric Test of Reciprocity Moment Tensors ### Step 0 Load packages ``` #load all packages import datetime import pickle import copy import os from sys import argv from pathlib import Path import numpy as np import pandas as pd import pyvista as pv import matplotlib.pyplot as plt from matplotlib.colors import ...
github_jupyter
# Representação numérica de palavras e textos Neste notebook iremos apresentação formas de representar valores textuais por meio de representação numérica. Iremos usar pandas, caso queira entender um pouco sobre pandas, [veja este notebook](pandas.ipynb). Por isso, não esqueça de instalar o módulo pandas: ``pip3 inst...
github_jupyter
""" author: Dominik Stec, index: s12623, email: s12623@pja.edu.pl To run module: import module into Google Colaboratory notebook and run. This module recognize type of clothes according to given image of clothe. Keras model is build as classification type and contains two types of classification ne...
github_jupyter
# Machine Learning Engineer Nanodegree ## Reinforcement Learning ## Project: Train a Smartcab to Drive Welcome to the fourth project of the Machine Learning Engineer Nanodegree! In this notebook, template code has already been provided for you to aid in your analysis of the *Smartcab* and your implemented learning alg...
github_jupyter
# Hash Codes Consider the challenges associated with the 16-bit hashcode for a character string `s` that sums the Unicode values of the characters in `s`. For example, let `s = "stop"`. It's unicode character representation is: ``` for char in "stop": print(char + ': ' + str(ord(char))) sum([ord(x) for x in "stop...
github_jupyter
<a href="http://landlab.github.io"><img style="float: left" src="../../media/landlab_header.png"></a> # The deAlmeida Overland Flow Component <hr> <small>For more Landlab tutorials, click here: <a href="https://landlab.readthedocs.io/en/latest/user_guide/tutorials.html">https://landlab.readthedocs.io/en/latest/user_g...
github_jupyter
``` import tensorflow as tf import matplotlib.pyplot as plt from sklearn.pipeline import Pipeline from sklearn import datasets, linear_model from sklearn import cross_validation import numpy as np import pandas as pd from sklearn import preprocessing df = pd.read_excel("data0505.xlsx",header=0) # clean up data df = df...
github_jupyter
``` import numpy as np import scipy from scipy import sparse import scipy.sparse.linalg import matplotlib.pyplot as plt %matplotlib inline # part a) Id = sparse.csr_matrix(np.eye(2)) Sx = sparse.csr_matrix([[0., 1.], [1., 0.]]) Sz = sparse.csr_matrix([[1., 0.], [0., -1.]]) print(Sz.shape) # part b) def singesite_to_ful...
github_jupyter
# Predicting Boston Housing Prices ## Using XGBoost in SageMaker (Deploy) _Deep Learning Nanodegree Program | Deployment_ --- As an introduction to using SageMaker's Low Level Python API we will look at a relatively simple problem. Namely, we will use the [Boston Housing Dataset](https://www.cs.toronto.edu/~delve/d...
github_jupyter
``` import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from mnist import MNIST mnist= MNIST('mnist/') X_train,y_train=mnist.load_training() X_test,y_test=mnist.load_testing() X_train=np.asarray(X_train).astype(np.float32) y_train=np.asarray(y_train).astype(np.float32) X_tes...
github_jupyter
<center><img src="./images/logo_fmkn.png" width=300 style="display: inline-block;"></center> ## Машинное обучение ### Семинар 13. ЕМ-алгоритм <br /> <br /> 9 декабря 2021 Будем решать задачу восставновления картинки лица по набору зашумленных картинок (взято с курса deep bayes 2018 https://github.com/bayesgroup/dee...
github_jupyter
# Near real-time HF-Radar currents in the proximity of the Deepwater Horizon site The explosion on the Deepwater Horizon (DWH) tragically killed 11 people, and resulted in one of the largest marine oil spills in history. One of the first questions when there is such a tragedy is: where will the oil go? In order the h...
github_jupyter
## define what to cluster This document contains part of the codes in -lfc dataset = 0.6 (July 2015) minimum number of studies = 80 mask = bilateral ATL ``` %matplotlib inline from neurosynth.base.dataset import Dataset dataset = Dataset.load("data/neurosynth_0.6_400_4.pkl") from neurosynth.analysis.cluster import ...
github_jupyter
### DeRT analysis using Iris dataset ``` from sklearn.datasets import load_iris from sklearn.preprocessing import StandardScaler from kitchen.dert.dert_models import FeatureDrivenModel, CombinedModel import numpy as np from nltk.translate.bleu_score import sentence_bleu iris = load_iris() X = iris['data'] y = iris['t...
github_jupyter
<a href="https://colab.research.google.com/github/hwangsog/magenta/blob/master/MusicVAE.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> Copyright 2017 Google LLC. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this ...
github_jupyter
# Project 3: Smart Beta Portfolio and Portfolio Optimization ## Overview Smart beta has a broad meaning, but we can say in practice that when we use the universe of stocks from an index, and then apply some weighting scheme other than market cap weighting, it can be considered a type of smart beta fund. A Smart Bet...
github_jupyter
``` import pandas as pd import numpy as np # from sklearn.model_selection import train_test_split import torch from torch import nn from torch import optim # import json # from torch.utils.data import Dataset, DataLoader # import transformers from transformers import RobertaModel, RobertaTokenizer, RobertaForMultipleCh...
github_jupyter
# Python Stock Trading Quick Start with Alpaca #### by Billy Hau The purpose of this tutorial is to provide a quick start guide to trade stock with python. We will use the Alpaca trading platform since it is free and support paper trading. We will go over the fundamental operations, such as connecting to an account, c...
github_jupyter
# Homework: Basic Artificial Neural Networks ``` %matplotlib inline from time import time, sleep import numpy as np import matplotlib.pyplot as plt from IPython import display ``` # Framework Implement everything in `Modules.ipynb`. Read all the comments thoughtfully to ease the pain. Please try not to change the pr...
github_jupyter
``` !date import numpy as np, pandas as pd, matplotlib.pyplot as plt, seaborn as sns %matplotlib inline sns.set_context('paper') sns.set_style('darkgrid') ``` # Mixture Model in PyMC3 Original NB by Abe Flaxman, modified by Thomas Wiecki ``` import pymc3 as pm, theano.tensor as tt # simulate data from a known mixtur...
github_jupyter
``` def bubbleSort(arr): n=len(arr) for i in range(n): for j in range(0, n-i-1): if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j] arr = [3,2,6,4,5,8] bubbleSort(arr) print ("Sorted array is:") for i in range(len(arr)): print ("%d" %arr[i]), def...
github_jupyter
``` # default_exp timestep #hide import sys [sys.path.append(i) for i in ['.', '..']] #hide from nbdev.showdoc import * %load_ext autoreload %autoreload 2 #export from nbdev_qq_test.solution import * from nbdev_qq_test.initialize import calculate_HI_linear, calculate_HIGC from nbdev_qq_test.classes import * import nu...
github_jupyter
# Self-Driving Car Engineer Nanodegree ## Project: **Finding Lane Lines on the Road** *** In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j...
github_jupyter
``` # Set in root_directory %cd /home/ronald/PycharmProjects/x-ray-deep-learning/X-ray_Object_Detection/ #%ls # libs import numpy as np from pathlib import Path import json np.random.seed(1) # Directories ROOT = Path('data/raw') images_path = ROOT / 'images' ann_path = ROOT/ 'annotation' print('Images Path:'...
github_jupyter
``` import numpy as np import pandas as pd string_data=pd.Series(['aardvark','artichoke',np.nan,'avocado']) string_data string_data.isnull() string_data[0]=None string_data.isnull() from numpy import nan as NA data=pd.Series([1,NA,3.5,NA,7]) data.dropna() data[data.notnull()] data=pd.DataFrame([[1.,6.5,3.],[1.,NA,NA],[...
github_jupyter
# ML2CPP ## Preparing the dataset ``` from sklearn import datasets import numpy as np import pandas as pd boston = datasets.load_boston() def populate_table(tablename, feature_names): X = boston.data y = boston.target N = X.shape[0] y = y.reshape(N,1) k = np.arange(N).reshape(N, 1) k_X_y =...
github_jupyter
### Neural style transfer in PyTorch This tutorial implements the "slow" neural style transfer based on the VGG19 model. It closely follows the official neural style tutorial you can find [here](http://pytorch.org/tutorials/advanced/neural_style_tutorial.html). __Note:__ if you didn't sit through the explanation of ...
github_jupyter
## Implementing a 1D convnet In Keras, you would use a 1D convnet via the `Conv1D` layer, which has a very similar interface to `Conv2D`. It **takes as input 3D tensors with shape (samples, time, features) and also returns similarly-shaped 3D tensors**. The convolution window is a 1D window on the temporal axis, axis ...
github_jupyter
# Figures 2 and 5 for gather paper ``` %matplotlib inline import pylab import pandas as pd ``` ## Preparation: load genome-grist summary CSVs ``` class SampleDFs: def __init__(self, name, all_df, left_df, gather_df, names_df): self.name = name self.all_df = all_df self.left_df = left_df ...
github_jupyter
<a href="https://colab.research.google.com/github/samarth0174/Face-Recognition-pca-svm/blob/master/Facial_Recognition(Exercise).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # **In this project we implement the Identification system using Machine ...
github_jupyter
``` !pip install torch # framework !pip install --upgrade reedsolo !pip install --upgrade librosa !pip install torchvision #!pip install torchaudio #!pip install tensorboard #!pip install soundfile !pip install librosa==0.7.1 from google.colab import drive drive.mount('/content/drive',force_remount=True) %cd /content...
github_jupyter
# **[Adversarial Disturbances for Controller Verification](http://proceedings.mlr.press/v144/ghai21a/ghai21a.pdf)** [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/google/nsc-tutorial/blob/main/controller-verification.ipynb) ## Housekeeping Imports...
github_jupyter
# Aim: * Extract features for logistic regression given some text * Implement logistic regression from scratch * Apply logistic regression on a natural language processing task * Test logistic regression We will be using a data set of tweets. ## Import functions and data ``` import nltk from nltk.corpus import twit...
github_jupyter
# import data ``` import os import glob from PIL import Image import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split def read_feature(folder, num): filename = glob.glob(os.path.join(folder, '*')) img_arr = np.zeros([len(filename), 100, 1...
github_jupyter
## Import the needed libraries ``` import PicSureHpdsLib import pandas import matplotlib ``` ## Create an instance of the datasource adapter and get a reference to the data resource ``` adapter = PicSureHpdsLib.BypassAdapter("http://pic-sure-hpds-nhanes:8080/PIC-SURE") resource = adapter.useResource() ``` ## Get a ...
github_jupyter
## Appendix (Application of the mutual fund theorem) ``` import pandas as pd import numpy as np import matplotlib.pyplot as plt import FinanceDataReader as fdr import pandas as pd ticker_list = ['069500'] df_list = [fdr.DataReader(ticker, '2015-01-01', '2016-12-31')['Change'] for ticker in ticker_list] df = pd.conc...
github_jupyter
## 前言 本文主要讨论如何把pandas移植到spark, 他们的dataframe共有一些特性如操作方法和模式。pandas的灵活性比spark强, 但是经过一些改动spark基本上能完成相同的工作。 同时又兼具了扩展性的优势,当然他们的语法和用法稍稍有些不同。 ## 主要不同处: ### 分布式处理 pandas只能单机处理, 把dataframe放进内存计算。spark是集群分布式地,可以处理的数据可以大大超出集群的内存数。 ### 懒执行 spark不执行任何`transformation`直到需要运行`action`方法,`action`一般是存储或者展示数据的操作。这种将`transformation`延后的做法...
github_jupyter
# Distant Viewing with Deep Learning: Part 2 In Part 2 of this tutorial, we introduce the concepts of deep learning and show it yields interesting similarity metrics and is able to extract feature useful features such as the presence and location of faces in the image. ## Step 9: Python modules for deep learning We ...
github_jupyter
# Putting the "Re" in Reformer: Ungraded Lab This ungraded lab will explore Reversible Residual Networks. You will use these networks in this week's assignment that utilizes the Reformer model. It is based on on the Transformer model you already know, but with two unique features. * Locality Sensitive Hashing (LSH) Att...
github_jupyter
# MICROSOFT STOCK PRICE TIME SERIES ANALYSIS Within this Jupyter Notebook, we will attempt to forecast and model the future price of Microsoft stock through Time Series Analysis and SARIMAX models, while also modelling out potential trades and profits that could be made based on our forecast through training and test ...
github_jupyter
The visualization used for this homework is based on Alexandr Verinov's code. # Generative models In this homework we will try several criterions for learning an implicit model. Almost everything is written for you, and you only need to implement the objective for the game and play around with the model. **0)** Rea...
github_jupyter
BYÖYO 2018 Yapay Öğrenmeye Giriş I Ali Taylan Cemgil 2 Temmuz 2018 # Parametrik Regresyon, Parametrik Fonksyon Oturtma Problemi (Parametric Regression, Function Fitting) Verilen girdi ve çıktı ikilileri $x, y$ için parametrik bir fonksyon $f$ oturtma problemi. Parametre $w$ değerlerini öyle bir seçelim ki $$ ...
github_jupyter
## Introduction to the Pipelines SDK The [Kubeflow Pipelines SDK](https://github.com/kubeflow/pipelines/tree/master/sdk) provides a set of Python packages that you can use to specify and run your machine learning (ML) workflows. A pipeline is a description of an ML workflow, including all of the components that make u...
github_jupyter
``` import numpy as np class MultiLayerPerceptron(): def __init__(self): self.inputLayer = 1 self.hiddenLayer = np.array([3]) self.outputLayer = [1] self.learningRate = 0.5 self.weights = self.starting_weights() self.bias = self.starting_bias() self.trans...
github_jupyter
``` import sys import os import h5py import json import numpy as np %matplotlib inline import matplotlib.pyplot as plt import IPython.display as ipd from stimuli_f0_labels import get_f0_bins, f0_to_label fn = '/om4/group/mcdermott/user/msaddler/pitchnet_dataset/pitchnetDataset/assets/data/processed/dataset_2019-11-22...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Load-Data" data-toc-modified-id="Load-Data-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Load Data</a></span></li><li><span><a href="#Compare-dimensionalities" data-toc-modified-id="Compare-dimensionali...
github_jupyter
# Image Classification The *Computer Vision* cognitive service provides useful pre-built models for working with images, but you'll often need to train your own model for computer vision. For example, suppose the Northwind Traders retail company wants to create an automated checkout system that identifies the grocery ...
github_jupyter
``` import numpy as np import pandas as pd from sklearn import linear_model from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D %matplotlib inline #%matplotlib notebook data=pd.read_csv('test_point.dat', header = None, sep = ' ') data1=data.dropna(axis=1) data1.shape[1] #data1.iloc[:,3] ols=lin...
github_jupyter
## Deploy a simple S3 dispersed storage archive solution #### Requirements In order to be able to deploy this example deployment you will have to have the following components activated - the 3Bot SDK, in the form of a local container with the SDK, or a grid based SDK container. Getting started instuctions are [here]...
github_jupyter
<a href="https://colab.research.google.com/github/anders447/sample-ds-blog-anders/blob/master/_notebooks/2021-05-09-Pedestrian_detector.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # pedestrian detector https://pytorch.org/tutorials/intermediate...
github_jupyter
``` %pylab inline import numpy as np import pandas as pd import scipy.stats from matplotlib.backends.backend_pdf import PdfPages import sys sys.path.append("../errortools/") import errortools ``` # Fitting and predicting ``` ndim = 3 fit_intercept = True ndata = 100 p_true = [2, 0, -2, 0] np.random.seed(42) X = np.r...
github_jupyter
``` import this print("this is my first program. ") len("fazlullah") a = 10 a type(a) b = 45.5 type(b) c = "fazlullah" type(c) d = 5+6j type(d) g = True type(g) *a = 67 _a = 88 type(a) a = 34 type(_a) a, b, c, d, e = 124,"fazlullah",6+8j,False,88.2 a b c a = "sudh" a+str(4) True + True True - False 1 + True a = input()...
github_jupyter
# Predicting Boston Housing Prices ## Updating a model using SageMaker _Deep Learning Nanodegree Program | Deployment_ --- In this notebook, we will continue working with the [Boston Housing Dataset](https://www.cs.toronto.edu/~delve/data/boston/bostonDetail.html). Our goal in this notebook will be to train two dif...
github_jupyter
``` %load_ext autoreload %autoreload 2 import sys import importlib import re import pandas as pd import sqlalchemy as sa import pudl import logging logger = logging.getLogger() logger.setLevel(logging.INFO) handler = logging.StreamHandler(stream=sys.stdout) formatter = logging.Formatter('%(message)s') handler.setForm...
github_jupyter
# Deploy a Trained MXNet Model In this notebook, we walk through the process of deploying a trained model to a SageMaker endpoint. If you recently ran [the notebook for training](get_started_mnist_deploy.ipynb) with %store% magic, the `model_data` can be restored. Otherwise, we retrieve the model artifact from a publi...
github_jupyter
# Nova Tarefa - Experimento Preencha aqui com detalhes sobre a tarefa.<br> ### **Em caso de dúvidas, consulte os [tutoriais da PlatIAgro](https://platiagro.github.io/tutorials/).** ## Declaração de parâmetros e hiperparâmetros Declare parâmetros com o botão <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQ...
github_jupyter
# 12-Web-Scraping-and-Document-Databases Eric Nordstrom ### Setup ``` # dependencies from selenium import webdriver from bs4 import BeautifulSoup as BS import requests import pandas as pd # set up selenium driver driver = webdriver.Firefox() ``` ### NASA Mars News ``` # get html to parse url = "https://mars.nasa.g...
github_jupyter
``` %matplotlib inline ``` PyTorch 1.0 Distributed Trainer with Amazon AWS =============================================== **Author**: `Nathan Inkawhich <https://github.com/inkawhich>`_ **Edited by**: `Teng Li <https://github.com/teng-li>`_ In this tutorial we will show how to setup, code, and run a PyTorch 1.0 di...
github_jupyter
``` # Copyright 2021 Google LLC # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. # Notebook authors: Kevin P. Murphy (murphyk@gmail.com) # and Mahmoud Soliman (mjs@aucegypt.edu) # This notebook reproduces figures for chap...
github_jupyter
# Common Workflow Language with BioExcel Building Blocks ### Based on the Protein MD Setup tutorial using BioExcel Building Blocks (biobb) *** This tutorial aims to illustrate the process of **building up a CWL workflow** using the **BioExcel Building Blocks library (biobb)**. The tutorial is based on the **Protein Gro...
github_jupyter
``` import xarray as xr import matplotlib.pyplot as plt import cartopy.crs as ccrs from scipy.io import loadmat #where to find the data adir= 'F:/data/fluxsat/WS_SST_Correlation/' #read in the data ds1=xr.open_dataset(adir+'Corr_High_redone.nc') ds1.close() ds2=xr.open_dataset(adir+'Corr_Full.nc') #Full: corelation...
github_jupyter
# Copy Task Plots ``` import matplotlib.pyplot as plt import numpy as np import pandas as pd from glob import glob import json import os import sys sys.path.append(os.path.abspath(os.getcwd() + "./../")) %matplotlib inline ``` ## Load training history To generate the models and training history used in this notebo...
github_jupyter
# Imports & Installations ``` !pip install pyforest !pip install plotnine !pip install transformers !pip install psycopg2-binary !pip uninstall -y tensorflow-datasets !pip install lit_nlp tfds-nightly transformers==4.1.1 # Automatic library importer (doesn't quite import everything yet) from pyforest import * # Expan...
github_jupyter
``` from programming_for_biology.data_analysis.cell_polygons import read_disc, Coordinates import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Polygon from matplotlib.collections import PatchCollection import scipy from scipy import stats #function to draw the wing disc def draw_disc(cpx,...
github_jupyter
# HW8: Topic Modeling ``` ## ======================================================= ## IMPORTING ## ======================================================= import os def get_data_from_files(path): directory = os.listdir(path) results = [] for file in directory: f=open(path+file, encoding = "ISO-8...
github_jupyter
### 1. Gradient Descent Tips *Nhắc lại*: Công thức cập nhật $\theta$ ở vòng lặp thứ $t$: <center>$\theta_{t+1} := \theta_t - \alpha \Delta_{\theta} f(\theta_t)$</center> Trong đó: - $\alpha$: learning rate - tốc độ học tập. - $\Delta_{\theta} f(\theta_t)$: đạo hàm của hàm số tại điểm $\theta$. Việc lựa chọn giá trị...
github_jupyter
``` import math import numpy as np import matplotlib.pyplot as plt F = np.array([[-1,0],[0,1]]) ACB = [150, -60, 60, -90] ABC = [150, 60, -60, 30] BAC = [-90, -60, 60, 30] BCA = [-90, 60, -60, 150] CBA = [30, -60, 60, 150] CAB = [30, 60, -60, -90] del_s=np.exp(1.31j) del_p=np.exp(2.05j) P=np.array([[del_s, 0],[0, d...
github_jupyter
``` import warnings import time from data import * #from data_transforms import * from apex import amp from torch import nn from torch.utils.data import Dataset, DataLoader, Subset from sklearn.preprocessing import LabelEncoder from sklearn.metrics import accuracy_score, roc_auc_score from sklearn.model_selection impor...
github_jupyter