code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Tutorial 5: Trace - training control and debugging
In this tutorial, we will talk about another important concept in FastEstimator - Trace.
`Trace` is a class contains has 6 event functions below, each event function will be executed on different events of training loop when putting `Trace` inside `Estimator`. If y... | github_jupyter |
# Flopy MODFLOW Boundary Conditions
Flopy has a new way to enter boundary conditions for some MODFLOW packages. These changes are substantial. Boundary conditions can now be entered as a list of boundaries, as a numpy recarray, or as a dictionary. These different styles are described in this notebook.
Flopy also n... | github_jupyter |
<a href="https://colab.research.google.com/github/rvignav/aigents-java-nlp/blob/master/src/test/resources/Baseline_QA/Baseline_QA_ELECTRA.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!pip install --quiet transformers sentence-transformers nlt... | github_jupyter |
# Machine Translation Inference Pipeline
## Packages
```
import os
import shutil
from typing import Dict
from transformers import T5Tokenizer, T5ForConditionalGeneration
from forte import Pipeline
from forte.data import DataPack
from forte.common import Resources, Config
from forte.processors.base import PackProcessor... | github_jupyter |
# T81-558: Applications of Deep Neural Networks
* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), School of Engineering and Applied Science, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)
* For more information visit the [class website](https://sites.wust... | github_jupyter |
```
import statistics
import pprint
import pandas as pd
import numpy as np
from random import uniform
from tslearn.utils import to_time_series_dataset
from tslearn.metrics import dtw#, gak
import plotly.express as px
import scipy.stats as st
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import s... | github_jupyter |
# Reading and writing fields
There are two main file formats to which a `discretisedfield.Field` object can be saved:
- [VTK](https://vtk.org/) for visualisation using e.g., [ParaView](https://www.paraview.org/) or [Mayavi](https://docs.enthought.com/mayavi/mayavi/)
- OOMMF [Vector Field File Format (OVF)](https://ma... | github_jupyter |
# Sesiones prácticas
## 0
Instalación de Python + ecosistema científico + opencv + opengl
- aula virtual -> página web -> install
- git o unzip master
- anaconda completo o miniconda
- windows: opencv y probar los ejemplos
- linux: primer método más seguro, con paquetes seleccionados
- probar webcam.py stream.py, su... | github_jupyter |
```
# Import the SPICE module
import spiceypy
# We want to determine the position of our home planet with respect to the Sun.
# The datetime shall be set as "today" (midnight). SPICE requires the
# Ephemeris Time (ET); thus, we need to convert a UTC datetime string to ET.
import datetime
# get today's date
DATE_TODAY... | github_jupyter |
<img align="center" style="max-width: 1000px" src="banner.png">
<img align="right" style="max-width: 200px; height: auto" src="hsg_logo.png">
## Lab 05 - "Convolutional Neural Networks (CNNs)" Assignments
GSERM'21 course "Deep Learning: Fundamentals and Applications", University of St. Gallen
In the last lab we le... | github_jupyter |
# Calibrate mean and integrated intensity of a fluorescence marker versus concentration
## Requirements
- Images with different concentrations of the fluorescent tag with the concentration clearly specified in the image name
Prepare pure solutions of various concentrations of fluorescent tag in imaging media and col... | github_jupyter |
# Circuit Quantum Electrodynamics
## Contents
1. [Introduction](#intro)
2. [The Schrieffer-Wolff Transformation](#tswt)
3. [Block-diagonalization of the Jaynes-Cummings Hamiltonian](#bdotjch)
4. [Full Transmon](#full-transmon)
5. [Qubit Drive with cQED](#qdwcqed)
6. [The Cross Resonance Entangling Gate](#tcreg)
## 1... | github_jupyter |
[[source]](../api/alibi.explainers.anchor_tabular.rst)
# Anchors
## Overview
The anchor algorithm is based on the [Anchors: High-Precision Model-Agnostic Explanations](https://homes.cs.washington.edu/~marcotcr/aaai18.pdf) paper by Ribeiro et al. and builds on the open source [code](https://github.com/marcotcr/anchor... | github_jupyter |
```
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from sklearn.metrics import accuracy_score
import numpy as np
from torch.utils.tensorboard import SummaryWriter
from tqdm.notebook import tqdm
torch.manual_seed(824)
np.random.seed(824)
np.set_printoptions(threshold=np.inf)
# build tr... | github_jupyter |
# Tutorial sobre Scala
## Declaraciones
### Declaración de variables
Existen dos categorias de variables: inmutables y mutables. Las variables mutables son aquellas en las que es posible modificar el contenido de la variable. Las variables inmutables son aquellas en las que no es posible alterar el contenido de las ... | github_jupyter |
# Colab FAQ
For some basic overview and features offered in Colab notebooks, check out: [Overview of Colaboratory Features](https://colab.research.google.com/notebooks/basic_features_overview.ipynb)
You need to use the colab GPU for this assignmentby selecting:
> **Runtime** → **Change runtime type** → **Har... | github_jupyter |
## Initial Setup
```
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import itertools
import os
import math
import string
import re
import numpy as np
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
import helper
import pickle
i... | github_jupyter |
```
import os, json, sys, time, random
import numpy as np
import torch
from easydict import EasyDict
from math import floor
from easydict import EasyDict
from steves_utils.vanilla_train_eval_test_jig import Vanilla_Train_Eval_Test_Jig
from steves_utils.torch_utils import get_dataset_metrics, independent_accuracy_as... | github_jupyter |
```
import numpy as np
%%html
<style>
.pquote {
text-align: left;
margin: 40px 0 40px auto;
width: 70%;
font-size: 1.5em;
font-style: italic;
display: block;
line-height: 1.3em;
color: #5a75a7;
font-weight: 600;
border-left: 5px solid rgba(90, 117, 167, .1);
padding-left: 6px;
}
.notes {
font-st... | github_jupyter |
```
import openmc
import openmc.deplete
%matplotlib inline
import numpy as np
fuel = openmc.Material(name="uo2")
fuel.add_element("U", 1, percent_type="ao", enrichment=4.25)
fuel.add_element("O", 2)
fuel.set_density("g/cc", 10.4)
clad = openmc.Material(name='clad');
clad.add_element("Zr",1);
clad.set_density('g/cc',6... | 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
# Input data files are available in the "../input/" directory.
# For example, runnin... | github_jupyter |
# Artificial Intelligence Nanodegree
## Voice User Interfaces
## Project: Speech Recognition with Neural Networks
---
In this notebook, some template code has already been provided for you, and you will need to implement additional functionality to successfully complete this project. You will not need to modify the... | github_jupyter |
```
# Copyright 2021 NVIDIA Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
# X is the 10 X 10 Hilbert Matrix
X = 1. / (np.arange(1, 11) + np.arange(0,10)[:, np.newaxis])
y = np.ones(10)
print(X.shape)
X
# Compute paths
n_alphas = 200
alphas = np.logspace(-10, -2, n_alphas)
coefs = []
for a in alphas:
... | github_jupyter |

# Add Column using Expression
With Azure ML Data Prep you can add a new column to data with `Dataflow.add_column` by using a Data Prep expr... | github_jupyter |
# Purpose: A basic object identification package for the lab to use
*Step 1: import packages*
```
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Sci-kit Image Imports
from skimage import io
from skimage import filters
from skimage.feature import canny
from skimage import... | github_jupyter |
```
from __future__ import print_function, unicode_literals, absolute_import, division
import sys
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
from glob import glob
from tqdm import tqdm
from tifffile import imread
from csbdeep.utils import Path, ... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Vectors/landsat_wrs2_grid.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_b... | github_jupyter |
```
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# set random seed for comparing the two result calculations
tf.set_random_seed(1)
# this is data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
# hyperparameters
lr = 0.001
training_iters = 100000
batch_size = 128
n... | github_jupyter |
This notebook shows:
* How to launch the [**StarGANv1**](https://arxiv.org/abs/1711.09020) model for inference
* Example of results for both
* attrubutes **detection**
* new face **generation** with desired attributes
Here I use [**PyTorch** implementation](https://github.com/yunjey/stargan) of the StarGANv1 m... | github_jupyter |
```
import pandas as pd
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.tree import export_text
```
This example uses the [Universal Bank](https://www.kaggle.com/sriharipramod/ba... | github_jupyter |
# Data Set-up and Cleaning
```
# Standard Library Imports
import pandas as pd
import numpy as np
```
For this section, I will be concatenating all the data sets into one large dataset.
### Load the datasets
```
inpatient = pd.read_csv('./data/Train_Inpatientdata-1542865627584.csv')
outpatient = pd.read_csv('./data/... | github_jupyter |
# Understanding the data
In this first part, we load the data and perform some initial exploration on it. The main goal of this step is to acquire some basic knowledge about the data, how the various features are distributed, if there are missing values in it and so on.
```
### imports
import pandas as pd
import seab... | github_jupyter |
# Finetuning of the pretrained Japanese BERT model
Finetune the pretrained model to solve multi-class classification problems.
This notebook requires the following objects:
- trained sentencepiece model (model and vocab files)
- pretraiend Japanese BERT model
Dataset is livedoor ニュースコーパス in https://www.rondhuit.com... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
from PIL import Image
import os
from sklearn.model_selection import train_test_split
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Con... | github_jupyter |
```
import json
import math
import numpy as np
import openrtdynamics2.lang as dy
import openrtdynamics2.targets as tg
from vehicle_lib.vehicle_lib import *
# load track data
with open("track_data/simple_track.json", "r") as read_file:
track_data = json.load(read_file)
#
# Demo: a vehicle controlled to follow a gi... | 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 |
# Tabular Datasets
As we have already discovered, Elements are simple wrappers around your data that provide a semantically meaningful representation. HoloViews can work with a wide variety of data types, but many of them can be categorized as either:
* **Tabular:** Tables of flat columns, or
* **Gridded:** Arr... | github_jupyter |
# First steps with xmovie
```
import warnings
import matplotlib.pyplot as plt
import xarray as xr
from shapely.errors import ShapelyDeprecationWarning
from xmovie import Movie
warnings.filterwarnings(
action='ignore',
category=ShapelyDeprecationWarning, # in cartopy
)
warnings.filterwarnings(
action="ig... | github_jupyter |
# Summarize titers and sequences by date
Create a single histogram on the same scale for number of titer measurements and number of genomic sequences per year to show the relative contribution of each data source.
```
import Bio
import Bio.SeqIO
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
imp... | github_jupyter |
```
import re
import pprint
import json
import logging
# re.match(pattern, string, flags=0)
print(re.match('www', 'www.qwer.com').span()) # 在起始位置匹配
print(re.match('com', 'www.qwer.com')) # 不在起始位置匹配
line = "Cats are smarter than dogs"
matchObj = re.match(r'(.*) are (.*?) (.*)', line, re.M | re.I)
if matchObj:
pr... | github_jupyter |
# 1- Class Activation Map with convolutions
In this firt part, we will code class activation map as described in the paper [Learning Deep Features for Discriminative Localization](http://cnnlocalization.csail.mit.edu/)
There is a GitHub repo associated with the paper:
https://github.com/zhoubolei/CAM
And even a demo... | github_jupyter |
```
# linear equations
# SolveLinearSystem.py
# Code to read A and b
# Then solve Ax = b for x by Gaussian elimination with back substitution
# linearsolver with pivoting adapted from
# https://stackoverflow.com/questions/31957096/gaussian-elimination-with-pivoting-in-python/31959226
def linearsolver(A,b):
n = len... | github_jupyter |
# Introduction to Deep Learning with PyTorch
In this notebook, you'll get introduced to [PyTorch](http://pytorch.org/), a framework for building and training neural networks. PyTorch in a lot of ways behaves like the arrays you love from Numpy. These Numpy arrays, after all, are just tensors. PyTorch takes these tenso... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import wikipedia
import xml.etree.ElementTree as ET
import re
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from sklearn.model_selection import cross_val_score
import xgboost as xgb
from sklearn.metrics import r2_score
... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import yaml
from pathlib import Path
from collections import defaultdict
from pandas.api.types import CategoricalDtype
EXPERIMENTS_PATH = Path.home() / "ba" / "experiments"
benchmarks_paths = list((EXPERIMENTS_PATH / "C4P4").glob("lb.*/*.benchma... | github_jupyter |
```
import pandas as pd
from os import getcwd
import numpy as np
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
getcwd()
infile_01 = 'crypto_data.csv'
df = pd.read_csv(infi... | github_jupyter |
# Circuit visualize
このドキュメントでは scikit-qulacs に用意されている量子回路を可視化します。
scikitqulacsには現在、以下のような量子回路を用意しています。
- create_qcl_ansatz(n_qubit: int, c_depth: int, time_step: float, seed=None): [arXiv:1803.00745](https://arxiv.org/abs/1803.00745)
- create_farhi_neven_ansatz(n_qubit: int, c_depth: int, seed: Optional[int] = None): ... | github_jupyter |
```
import pandas as pd
import numpy as np
```
## **Downloading data from Google Drive**
```
!pip install -U -q PyDrive
import os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
import zipfile
from google.colab i... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class Datafuzzy():
def __init__(self, score, decission):
self.score = score
self.decission = decission
markFollower = [0, 15000, 33000, 51000, 79000, 100000]
markEngagement = [0, 0.6, 1.7, 5, 7, 8, 10]
lingFollower = ['NANO',... | github_jupyter |
### Road Following - Live demo (TensorRT) with collision avoidance
### Added collision avoidance ResNet18 TRT
### threshold between free and blocked is the controller - action: just a pause as long the object is in front or by time
### increase in speed_gain requires some small increase in steer_gain (once a slider is... | github_jupyter |
```
# %load hovorka.py
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
def model(x, t, t_offset=None):
w = 100
ka1 = 0.006 #
ka2 = 0.06 #
ka3 = 0.03 #
kb1 = 0.0034 #
kb2 = 0.056 #
kb3 = 0.024 #
u_b = 0.0555
tmaxI = 55 #
VI = 0.12 * ... | github_jupyter |
# Building a Bayesian Network
---
In this tutorial, we introduce how to build a **Bayesian (belief) network** based on domain knowledge of the problem.
If we build the Bayesian network in different ways, the built network can have different graphs and sizes, which can greatly affect the memory requirement and infere... | github_jupyter |
# 1. Introduction
```
import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from prml.linear import (
LinearRegression,
RidgeRegression,
BayesianRegression... | github_jupyter |
```
from keras.layers import Input, Dropout, Dense, Flatten, concatenate
from keras.layers.convolutional import MaxPooling3D, Conv3D, Conv3DTranspose
from keras.models import Model
_input = Input(shape=(1, 3, 9600, 3600))
conv1 = Conv3D(32, (1, 2, 2), strides=(1, 2, 2),
activation='relu', padding='sa... | github_jupyter |
**Chapter 10 – Introduction to Artificial Neural Networks**
_This notebook contains all the sample code and solutions to the exercises in chapter 10._
# Setup
First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a func... | github_jupyter |
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
```
## Define a function for which we'd like to find the roots
```
def function_for_roots(x):
a = 1.01
b = -3.04
c = 2.07
return a*x**2 + b*x + c #get the roots of ax^2 + bx + c
```
## We need a function to check whether our i... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
*This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pytho... | github_jupyter |
```
import pandas as pd
import numpy as np
import os
import prody
import math
from pathlib import Path
import pickle
import sys
from sklearn.externals import joblib
from sklearn.metrics import r2_score,mean_squared_error
from abpred.Pipeline import PreparePredictions
def Kd_2_dG(Kd):
if Kd == 0:
... | github_jupyter |
# Example of extracting features from dataframes with Datetime indices
Assuming that time-varying measurements are taken at regular intervals can be sufficient for many situations. However, for a large number of tasks it is important to take into account **when** a measurement is made. An example can be healthcare, wh... | github_jupyter |
```
import yfinance as yf
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from cloudmesh.common.StopWatch import StopWatch
from tensorflow import keras
from pandas.plotting import register_matplotlib_converters
from sklearn.metrics import mean_squared_error
import pathlib
from pathlib import Path... | github_jupyter |
# TalkingData: Fraudulent Click Prediction
In this notebook, we will apply various boosting algorithms to solve an interesting classification problem from the domain of 'digital fraud'.
The analysis is divided into the following sections:
- Understanding the business problem
- Understanding and exploring the data
- F... | github_jupyter |
# Topic 2: Neural network
## Lesson 1: Introduction to Neural Networks
### 1. AND perceptron
Complete the cell below:
```
import pandas as pd
# TODO: Set weight1, weight2, and bias
weight1 = 0.0
weight2 = 0.0
bias = 0.0
# DON'T CHANGE ANYTHING BELOW
# Inputs and outputs
test_inputs = [(0, 0), (0, 1), (1, 0), (1,... | github_jupyter |
```
# lab1.py
#You should start here when providing the answers to Problem Set 1.
#Follow along in the problem set, which is at:
#http://ai6034.mit.edu/fall12/index.php?title=Lab_1
# Import helper objects that provide the logical operations
# discussed in class.
from production import IF, AND, OR, NOT, THEN, forward... | github_jupyter |
# AHDB wheat lodging risk and recommendations
This example notebook was inspired by the [AHDB lodging practical guidelines](https://ahdb.org.uk/knowledge-library/lodging): we evaluate the lodging risk for a field and output practical recommendations. We then adjust the estimated risk according to the Leaf Area Index (L... | github_jupyter |
```
import pandas as pd
import numpy as np
from scipy.io import arff
from scipy.stats import iqr
import os
import math
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import seaborn as sns
import datetime
import calendar
from numpy import mean
from numpy import std
from sklearn.preprocessing im... | github_jupyter |
# Settings
```
%load_ext autoreload
%autoreload 2
%env TF_KERAS = 1
import os
sep_local = os.path.sep
import sys
sys.path.append('..'+sep_local+'..')
print(sep_local)
os.chdir('..'+sep_local+'..'+sep_local+'..'+sep_local+'..'+sep_local+'..')
print(os.getcwd())
import tensorflow as tf
print(tf.__version__)
```
# Data... | github_jupyter |
# Modeling and Simulation in Python
Case study.
Copyright 2017 Allen Downey
License: [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0)
```
# Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an ... | github_jupyter |
# Python Solution for Hackerrank By Viraj Shetty
## Hello World
```
print("Hello, World!")
```
## Python If-Else
```
if __name__ == '__main__':
n = int(input().strip())
if(n%2==1):
print("Weird")
if(n%2==0):
if (n in range(2,5)):
print("Not Weird")
if (n in range(6,21... | github_jupyter |
<figure>
<IMG SRC="https://raw.githubusercontent.com/pastas/pastas/master/doc/_static/Art_logo.jpg" WIDTH=250 ALIGN="right">
</figure>
# Menyanthes File
*Developed by Ruben Caljé*
Menyanthes is timeseries analysis software used by many people in the Netherlands. In this example a Menyanthes-file with one observatio... | github_jupyter |
# Refactor: Wine Quality Analysis
In this exercise, you'll refactor code that analyzes a wine quality dataset taken from the UCI Machine Learning Repository [here](https://archive.ics.uci.edu/ml/datasets/wine+quality). Each row contains data on a wine sample, including several physicochemical properties gathered from t... | github_jupyter |
# A Whale off the Port(folio)
---
In this assignment, you'll get to use what you've learned this week to evaluate the performance among various algorithmic, hedge, and mutual fund portfolios and compare them against the S&P TSX 60 Index.
```
# Initial imports
import pandas as pd
import numpy as np
import datetime... | github_jupyter |
# Saying the same thing multiple ways
What happens when someone comes across a file in our file format? How do they know what it means?
If we can make the tag names in our model globally unique, then the meaning of the file can be made understandable
not just to us, but to people and computers all over the world.
Tw... | github_jupyter |
# Basic Python
Introduction to some basic python data types.
```
x = 1
y = 2.0
s = "hello"
l = [1, 2, 3, "a"]
d = {"a": 1, "b": 2, "c": 3}
```
Operations behave as per what you would expect.
```
z = x * y
print(z)
# Getting item at index 3 - note that Python uses zero-based indexing.
print(l[3])
# Getting the inde... | github_jupyter |
# Python programming for beginners
anton.kichev@clarivate.com
## Agenda
1. Background, why Python, [installation](#installation), IDE, setup
2. Variables, Boolean, None, numbers (integers, floating point), check type
3. List, Set, Dictionary, Tuple
4. Text and regular expressions
5. Conditions, loops
6. Objects and Fu... | github_jupyter |
# AMATH 515 Homework 2
**Due Date: 02/08/2019**
* Name: Tyler Chen
* Student Number:
*Homework Instruction*: Please follow order of this notebook and fill in the codes where commented as `TODO`.
```
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
```
## Please complete the solvers in `so... | github_jupyter |
# Start with simplest problem
I feel like clasification is the easiest problem catogory to start with.
We will start with simple clasification problem to predict survivals of titanic https://www.kaggle.com/c/titanic
# Contents
1. [Basic pipeline for a predictive modeling problem](#1)
1. [Exploratory Data Analysis (E... | github_jupyter |
# ディープラーニングに必要な数学と NumPy の操作
# 1. NumPy の基本
## NumPy のインポート
```
import numpy as np
```
## ndarray による1次元配列の例
```
a1 = np.array([1, 2, 3]) # 1次元配列を生成
print('変数の型:',type(a1))
print('データの型 (dtype):', a1.dtype)
print('要素の数 (size):', a1.size)
print('形状 (shape):', a1.shape)
print('次元の数 (ndim):', a1.ndim)
print('中身:', a1... | github_jupyter |
<a href="https://colab.research.google.com/github/mohameddhameem/TensorflowCertification/blob/main/Natural%20Language%20Processing%20in%20TensorFlow/Lesson%203/NLP_Course_Week_3_Exercise_Question.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
#... | github_jupyter |
# 01.2 Scattering Compute Speed
**NOT COMPLETED**
In this notebook, the speed to extract scattering coefficients is computed.
```
import sys
import random
import os
sys.path.append('../src')
import warnings
warnings.filterwarnings("ignore")
import torch
from tqdm import tqdm
from kymatio.torch import Scattering2D
i... | github_jupyter |
<!--NOTEBOOK_HEADER-->
*This notebook contains material from [nbpages](https://jckantor.github.io/nbpages) by Jeffrey Kantor (jeff at nd.edu). The text is released under the
[CC-BY-NC-ND-4.0 license](https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode).
The code is released under the [MIT license](https://opens... | github_jupyter |
# Homework #4
These problem sets focus on list comprehensions, string operations and regular expressions.
## Problem set #1: List slices and list comprehensions
Let's start with some data. The following cell contains a string with comma-separated integers, assigned to a variable called `numbers_str`:
```
numbers_st... | github_jupyter |
Used https://github.com/GoogleCloudPlatform/cloudml-samples/blob/master/xgboost/notebooks/census_training/train.py as a starting point and adjusted to CatBoost
```
#Google Cloud Libraries
from google.cloud import storage
#System Libraries
import datetime
import subprocess
#Data Libraries
import pandas as pd
import ... | github_jupyter |
```
import requests
import csv
import pandas as pd
import feedparser
import re
file = open("newfeed3.csv","w",encoding="utf-8")
writer = csv.writer(file)
writer.writerow(["Title","Description","Link","Year","Month"])
feed = open("FinalUrl.txt","r")
urls = feed.read()
urls = urls.split("\n")
df = pd.DataFrame(columns=["... | github_jupyter |
Final models with hyperparameters tuned for Logistics Regression and XGBoost with selected features.
```
#Import the libraries
import pandas as pd
import numpy as np
from tqdm import tqdm
from sklearn import linear_model, metrics, preprocessing, model_selection
from sklearn.preprocessing import StandardScaler
import ... | github_jupyter |
# Dealing with errors after a run
In this example, we run the model on a list of three glaciers:
two of them will end with errors: one because it already failed at
preprocessing (i.e. prior to this run), and one during the run. We show how to analyze theses erros and solve (some) of them, as described in the OGGM docu... | github_jupyter |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/6_freeze_base_network/2.2)%20Understand%20the%20effect%20of%20freezing%20base%20model%20in%20transfer%20learning%20-%202%20-%20pytorch.ipynb" target="_parent"><img src="https://colab.resea... | github_jupyter |
## 使用TensorFlow的基本步骤
以使用LinearRegression来预测房价为例。
- 使用RMSE(均方根误差)评估模型预测的准确率
- 通过调整超参数来提高模型的预测准确率
```
from __future__ import print_function
import math
from IPython import display
from matplotlib import cm
from matplotlib import gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from sklea... | github_jupyter |
# test note
* jupyterはコンテナ起動すること
* テストベッド一式起動済みであること
```
!pip install --upgrade pip
!pip install --force-reinstall ../lib/ait_sdk-0.1.7-py3-none-any.whl
from pathlib import Path
import pprint
from ait_sdk.test.hepler import Helper
import json
# settings cell
# mounted dir
root_dir = Path('/workdir/root/ait')
ait_n... | github_jupyter |
```
%load_ext rpy2.ipython
%matplotlib inline
import logging
logging.getLogger('fbprophet').setLevel(logging.ERROR)
import warnings
warnings.filterwarnings("ignore")
```
## Python API
Prophet follows the `sklearn` model API. We create an instance of the `Prophet` class and then call its `fit` and `predict` methods.
... | github_jupyter |
## TensorFlow 2 Complete Project Workflow in Amazon SageMaker
### Data Preprocessing -> Code Prototyping -> Automatic Model Tuning -> Deployment
1. [Introduction](#Introduction)
2. [SageMaker Processing for dataset transformation](#SageMakerProcessing)
3. [Local Mode training](#LocalModeTraining)
4. [Local Mode en... | github_jupyter |
# Paralelizacion de entrenamiento de redes neuronales con TensorFlow
En esta seccion dejaremos atras los rudimentos de las matematicas y nos centraremos en utilizar TensorFlow, la cual es una de las librerias mas populares de arpendizaje profundo y que realiza una implementacion mas eficaz de las redes neuronales que ... | github_jupyter |
```
import safenet
safenet.setup_logger(file_level=safenet.log_util.WARNING)
myApp = safenet.App()
myAuth_,addData=safenet.safe_utils.AuthReq(myApp.ffi_app.NULL,0,0,id=b'crappy_chat_reloaded',scope=b'noScope'
,name=b'i_love_it',vendor=b'no_vendor',app_container=True,ffi=myApp.ffi_app)
encodedAuth... | github_jupyter |
# Tutorial 13: Skyrmion in a disk
> Interactive online tutorial:
> [](https://mybinder.org/v2/gh/ubermag/oommfc/master?filepath=docs%2Fipynb%2Findex.ipynb)
In this tutorial, we compute and relax a skyrmion in a interfacial-DMI material in a confined disk like geometry.
`... | github_jupyter |
# Reader - Implantação
Este componente utiliza um modelo de QA pré-treinado em Português com o dataset SQuAD v1.1, é um modelo de domínio público disponível em [Hugging Face](https://huggingface.co/pierreguillou/bert-large-cased-squad-v1.1-portuguese).<br>
Seu objetivo é encontrar a resposta de uma ou mais perguntas ... | github_jupyter |
# Estimator validation
This notebook contains code to generate Figure 2 of the paper.
This notebook also serves to compare the estimates of the re-implemented scmemo with sceb package from Vasilis.
```
import pandas as pd
import matplotlib.pyplot as plt
import scanpy as sc
import scipy as sp
import itertools
import... | github_jupyter |
# TRTR and TSTR Results Comparison
```
#import libraries
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
pd.set_option('precision', 4)
```
## 1. Create empty dataset to save metrics differences
```
DATA_TYPES = ['Real','GM','SDV','CTGAN',... | github_jupyter |
# Generating Simpson's Paradox
We have been maually setting, but now we should also be able to generate it more programatically. his notebook will describe how we develop some functions that will be included in the `sp_data_util` package.
```
# %load code/env
# standard imports we use throughout the project
import n... | github_jupyter |
# A Scientific Deep Dive Into SageMaker LDA
1. [Introduction](#Introduction)
1. [Setup](#Setup)
1. [Data Exploration](#DataExploration)
1. [Training](#Training)
1. [Inference](#Inference)
1. [Epilogue](#Epilogue)
# Introduction
***
Amazon SageMaker LDA is an unsupervised learning algorithm that attempts to describe ... | github_jupyter |
```
from skempi_utils import *
from scipy.stats import pearsonr
df = skempi_df
df_multi = df[~np.asarray([len(s)>8 for s in df.Protein])]
s_multi = set([s[:4] for s in df_multi.Protein])
s_groups = set([s[:4] for s in G1 + G2 + G3 + G4 + G5])
len(s_multi & s_groups), len(s_multi), len(s_groups)
df_multi.head()
from skl... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.