text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# 卷积神经网络
```
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers, datasets, Sequential
```
### 1. 自定义权值实现
**在 tensorflow 中:**
- $C_{in} = 输入通道数 = 卷积核通道数$
- $C_{out} = 卷积核数 = 输出通道数$
$$X:[b, h, w, C_{in}],W:[k, k, C_{in}, C_{out}]$$
$$\Downarrow$$
$$O:[b, h', w', C_{out}]$$
```
x ... | github_jupyter |
# Neural Networks #
As outlined in [Carreau and Bengio (2009)](references.ipynb), the parameters of the Phat distribution can also be fit utilizing a simple neural network. For a univariate model, the need for such a structure may not be obvious, but the structure can be built upon to add additional free paramters (su... | github_jupyter |
#Vowpal Wabbit parameter estimation
##MNIST PCA data
https://github.com/JohnLangford/vowpal_wabbit/wiki/Command-line-arguments
```
import re
import csv
import subprocess
from time import ctime
import pandas as pd
import numpy as np
import scipy
from matplotlib import pyplot as plt
%matplotlib inline
#%qtconsole
... | github_jupyter |
```
import matplotlib.pyplot as plt
%matplotlib inline
import cv2
import numpy as np
import pickle
from scipy.misc import imread, imresize
from birdseye import BirdsEye
from lanefilter import LaneFilter
from curves import Curves
from helpers import show_images, save_image, roi
from moviepy.editor import VideoFileCli... | github_jupyter |
```
import pandas as pd
import numpy as np
import logging
import time
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
import sys
sys.path.insert(1, '../')
from config import shuffled_csv, path_exps
from NN import NN_model, ReLU, MSE, L1_reg
from LevelMethod import LevelMethod
from NN.... | github_jupyter |
```
import skimage as ski
import numpy as np
import openpyxl as xl
import csv
import os
import xmltodict
import pandas as pd
"""
for this typical ETL pattern, this notebook explores EXTRACT
"""
plate1_path='/Volumes/GoogleDrive/My Drive/ELISAarrayReader/images_scienion/2020-01-15_plate4_AEP_Feb3_6mousesera'
# plate1_... | github_jupyter |
<a href="https://colab.research.google.com/github/probml/pyprobml/blob/master/book1/intro/caliban.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Running parallel jobs on Google Cloud using Caliban
[Caliban](https://github.com/google/caliban) is... | github_jupyter |
```
%matplotlib inline
```
Word Embeddings: Encoding Lexical Semantics
===========================================
Word embeddings are dense vectors of real numbers, one per word in your
vocabulary. In NLP, it is almost always the case that your features are
words! But how should you represent a word in a computer? ... | github_jupyter |
```
!pip install -qq tensorflow
!pip install -qq tensor2tensor
!pip install -qq pydub
!apt-get -qq update
!apt-get -qq install -y ffmpeg
!apt-get -qq install -y sox
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
import os
import collections
import base64
import cStringIO
import pydub
import ... | github_jupyter |
```
import pandas as pd
from os import listdir
from os.path import isfile, join
import matplotlib.pyplot as plt
from ipyleaflet import *
import json
import requests
from IPython.display import clear_output
from ipywidgets import HTML
onlyfiles = [f for f in listdir("spreadsheets/") if isfile(join("spreadsheets/", f))]... | github_jupyter |
# Game of Life
[Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life), introduced by John H. Conway in 1970, is a 2D cellular automaton that simulates a world populated by cells. The world is a 2D square grid that is, in principle, infinite. Each grid position represents a cell that can be either aliv... | github_jupyter |
# Experiments for Paper
This notebook contains all neural network experiments for the paper. The results are saved as CSV files for independent verification.
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
from nn_src.imports import *
DATA_DIR = '/scratch/srasp/ppnn_data/'
RESULTS_DIR = '/export/home/srasp/... | github_jupyter |
# Exponentiated Gradient Reduction
Exponentiated gradient reduction is an in-processing technique that reduces fair classification to a sequence of cost-sensitive classification problems, returning a randomized classifier with the lowest empirical error subject to
fair classification constraints. The code for expone... | 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 |
<a href="https://githubtocolab.com/giswqs/geemap/blob/master/examples/notebooks/57_cartoee_blend.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/></a>
Uncomment the following line to install [geemap](https://geemap.org) and [cartopy](https://scitools.org.... | github_jupyter |
# MNE
Open-source Python software for exploring, visualizing, and analyzing human neurophysiological data: MEG, EEG, sEEG, ECoG, and more.
<https://martinos.org/mne>
---
```
import numpy as np
pip install mne
from mne.datasets import eegbci
from mne.io import concatenate_raws, read_raw_edf
subject = 1
runs = [6, 1... | github_jupyter |
### BACKGROUND:
Currently, HondaWeb is the only known source of obtaining associate's basic information for almost any or all Honda associates from any Honda company. Basic information such as company name, division, department, location, email, etc. To discover what information can be obtained through HondaWeb prof... | github_jupyter |
```
import pandas as pd
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
from ast import literal_eval
import pickle
import pprint
pp = pprint.PrettyPrinter(depth=6)
matplotlib.rcParams['figure.figsize'] = (15.0, 5.0)
pd.set_option('display.max_columns', 150)
```
import os
thedir = 'rtp-torrent'
... | github_jupyter |
```
# -*- coding: utf-8 -*-
"""
Usage:
THEANO_FLAGS="device=gpu0" python exptBikeNYC.py
"""
from __future__ import print_function
import os
import pickle
import numpy as np
import math
from keras.optimizers import Adam
from keras.callbacks import EarlyStopping, ModelCheckpoint
from deepst.models.threewayConvLSTM i... | github_jupyter |
```
import cv2
from pathlib import Path
from random import *
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from skimage.feature import hog
from imutils import face_utils
#import dlib
import os
import pickle
np.random.seed(1000)
physical_devic... | github_jupyter |
Experiments with Yelp API
Notes:
* Documentation: https://www.yelp.com/developers/documentation/v3
* Limit of 25,000 calls per day (see FAQ)
* Options for search: https://www.yelp.com/developers/documentation/v3/business_search
* 'term', 'location', 'limit' (max 50), 'offset', 'price'
* 'categories' - comma-de... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.compose import ColumnTransformer
from termcolor import colored
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from sklearn.impute import SimpleImputer
from sklearn.model_selection import tra... | github_jupyter |
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# Challenge Notebook
## Problem: Given sorted arrays A, B, merge B into A in sorted order.
* [Constraints](#Constraints)
* [Test Cases](#... | github_jupyter |
```
import unittest
from decimal import Decimal
import age
resultHandler = age.newResultHandler()
def evalExp(exp):
value = resultHandler.parse(exp)
print(type(value), "|", exp, " --> " ,value )
mapStr = '{"name": "Smith", "num":123, "yn":true, "bigInt":123456789123456789123456789123456789::numeric}'
... | github_jupyter |
## More on Lists
### List slicing
*Slicing* uses the bracket operator (`[]`) to copies a *slice* out of a list. The syntax is `lst[start:stop:step]`. Every parameter is optional. The defaults are equivalent to writing `lst[0:len(lst):1]`.
Copy of whole list:
```
a_list = [1, 2, 'a', 'string', 3.14159, True, "red", ... | github_jupyter |
# Use Spark to predict credit risk with `ibm-watson-machine-learning`
This notebook introduces commands for model persistance to Watson Machine Learning repository, model deployment, and scoring.
Some familiarity with Python is helpful. This notebook uses Python 3.7 and Apache® Spark 2.4.
You will use **German Credi... | github_jupyter |
```
import csv
import numpy as np
from google.colab import drive
import pandas as pd
import json
import ast
import matplotlib.pyplot as plt
import collections
```
#Main Functions
```
def reverse_counts(counts, size=20):
"""
Reverses the keys of a dictionary (i.e. the characters in all the keys are reversed)
P... | github_jupyter |
```
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
```
# Images are numpy arrays
Images are represented in ``scikit-image`` using standard ``numpy`` arrays. This allows maximum inter-operability with other libraries in the scientific Python ecosystem, such as ``matplotlib`` and ``scipy``.
Let's s... | github_jupyter |
# Simulating noise on Amazon Braket
This notebook gives a detailed overview of noise simulations on Amazon Braket. Amazon Braket provides two noise simulators: a local noise simulator that you can use for free as part of the Braket SDK and a fully managed, high-performing noise simulator, DM1. Both simulators are base... | github_jupyter |
```
"""
IPython Notebook v4.0 para python 2.7
Librerías adicionales: Ninguna.
Contenido bajo licencia CC-BY 4.0. Código bajo licencia MIT. (c) Sebastian Flores.
"""
# Configuracion para recargar módulos y librerías
%reload_ext autoreload
%autoreload 2
from IPython.core.display import HTML
HTML(open("style/mat281.cs... | github_jupyter |
##### Copyright 2020 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | github_jupyter |
```
import os
import sys
import multiprocessing
import logging
import numpy as np
import pandas as pd
import mxnet as mx
from mxnet.io import DataDesc
from mxnet import nd, gluon, autograd
from mxnet.gluon.data import RecordFileDataset, ArrayDataset, Dataset
from mxnet.gluon.data.vision import transforms
from mxnet.gl... | github_jupyter |
# Goals
### 1. Learn to implement Inception A Block using monk
- Monk's Keras
- Monk's Pytorch
- Monk's Mxnet
### 2. Use network Monk's debugger to create complex blocks
### 3. Understand how syntactically different it is to implement the same using
- Traditional Keras
- Traditional Pytorch... | github_jupyter |
# Blood Glucose Predictions with LSTM network
### Imports
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
from statsmodels.tools.eval_measures import rmse
from sklearn.preprocessing import MinMaxScaler
from keras.preprocessing.sequence import TimeseriesGenerator
from kera... | github_jupyter |
People always ask: "can you randomize several times and use the proportion of selection, instead of
just one randomization"?
Let's try to figure this out.
```
import numpy as np
import regreg.api as rr
import seaborn as sns
%matplotlib inline
%load_ext rpy2.ipython
import matplotlib.pyplot as plt
import scipy.stats
... | github_jupyter |
```
# slow down a bit when hacking something together, e.g. I forgot to add a simple function call
# tuple unpacking is nice, but cannot be done in a nested list comprehension
# don't forget .items in for k,v in dict.items()
# use hashlib for md5 encodings
# multiline list comprehensions don't need extra parentheses,... | github_jupyter |
```
from fastai2.vision.all import *
torch
```
https://github.com/pytorch/pytorch/issues/34086
Code from
* https://github.com/pytorch/pytorch/blob/2f840b1662b487d5551d7230f8eb4d57645cfff5/test/test_autograd.py
* https://github.com/pytorch/pytorch/blob/2f840b1662b487d5551d7230f8eb4d57645cfff5/test/test_autograd.py
*... | github_jupyter |
```
# default_exp stats
%load_ext autoreload
%autoreload 2
```
# stats
> A way to access metadata on all the files due for processing.
```
#hide
from nbdev.showdoc import *
#export
import json
import os
import datetime
from pathlib import Path
from typing import Any
import pandas as pd
import numpy as np
import fit... | github_jupyter |
# 7.5 IMDb(Internet Movie Database)からDataLoaderを作成
- 本ファイルでは、IMDb(Internet Movie Database)のデータを使用して、感情分析(0:ネガティブ、1:ポジティブ)を2値クラス分類するためのDatasetとDataLoaderを作成します。
※ 本章のファイルはすべてUbuntuでの動作を前提としています。Windowsなど文字コードが違う環境での動作にはご注意下さい。
# 7.5 学習目標
1. テキスト形式のファイルデータからtsvファイルを作成し、torchtext用のDataLoaderを作成できるようになる
# 事前準備
書籍の指示に従... | github_jupyter |
# Before we start...
This colab notebook is a minimum demo for faceswap-GAN v2.2. Since colab allows maximum run time limit of 12 hrs, we will only train a lightweight model in this notebook. **The purpose of this notebook is not to train a model that produces high quality results but a quick overview for how faceswap... | github_jupyter |
# Timeseries anomaly detection using an Autoencoder
**Author:** [pavithrasv](https://github.com/pavithrasv)<br>
**Date created:** 2020/05/31<br>
**Last modified:** 2020/05/31<br>
**Description:** Detect anomalies in a timeseries using an Autoencoder.
## Introduction
This script demonstrates how you can use a reconst... | github_jupyter |
# Visualizations
This tutorial illustrates the core visualization utilities available in Ax.
```
import numpy as np
from ax.service.ax_client import AxClient
from ax.modelbridge.cross_validation import cross_validate
from ax.plot.contour import interact_contour
from ax.plot.diagnostic import interact_cross_validatio... | github_jupyter |
# Exploratory Data Analysis with Pandas
The main scope of this notebook is to perform an analysis of the reviews received for the applications (games) in Steam. Each row in the dataset represents a review made by one user (Author) about a specific application.
The goal will be to answer different possible research que... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors.
Licensed under the Apache License, Version 2.0 (the "License").
# DCGAN: An example with tf.keras and eager
<table class="tfo-notebook-buttons" align="left"><td>
<a target="_blank" href="https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflo... | github_jupyter |
```
#简单的user-based协同过滤算法示例代码
#寒小阳(hanxiaoyang.ml@gmail.com)
#构造一份打分数据集,可以去movielens下载真实的数据做实验
users = {"小明": {"中国合伙人": 5.0, "太平轮": 3.0, "荒野猎人": 4.5, "老炮儿": 5.0, "我的少女时代": 3.0, "肖洛特烦恼": 4.5, "火星救援": 5.0},
"小红":{"小时代4": 4.0, "荒野猎人": 3.0, "我的少女时代": 5.0, "肖洛特烦恼": 5.0, "火星救援": 3.0, "后会无期": 3.0},
"小阳": {"小... | github_jupyter |
# Assignment #04
## Exercise #04-01: a glimpse in the C language
This exercise can be done on a linux machine only!
```{tip}
You can use MyBinder's terminal if you don't have Linux!
```
Here is the C code sample from the lecture:
```c
#include <stdio.h>
int main ()
{
int a = 2;
int b = 3;
int c = a +... | github_jupyter |
# Summary of Quantum Operations
In this section we will go into the different operations that are available in Qiskit Terra. These are:
- Single-qubit quantum gates
- Multi-qubit quantum gates
- Measurements
- Reset
- Conditionals
- State initialization
We will also show you how to use the three different simulator... | github_jupyter |
# Transposonmapper output data postprocessing
```
## Importing the required python libraries
import os, sys
import warnings
import timeit
import numpy as np
import pandas as pd
import pkg_resources
```
# How to clean the wig and bed files
Here we will remove transposon insertions in .bed and .wig files that were m... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import scipy
import pickle
from matplotlib import patches, lines
%matplotlib inline
colors = pickle.load(open('./colors.p', 'rb'))
case_counts = pd.read_csv('../data/frequencies/reich2013_case_counts.csv', index_col=0)
cas... | github_jupyter |
```
# for use in tutorial and development; do not include this `sys.path` change in production:
import sys ; sys.path.insert(0, "../")
```
# Vector embedding with `gensim`
Let's make use of deep learning through a technique called *embedding* – to analyze the relatedness of the labels used for recipe ingredients.
Am... | github_jupyter |
# Variational Autoencoder in TensorFlow
[Variational Autoencoders](https://arxiv.org/abs/1312.6114) (VAE) are a popular model that allows for unsupervised (and semi-supervised) learning. In this notebook, we'll implement a simple VAE on the MNIST dataset.
One of the primary goals of the VAE (and auto-encoders in gene... | github_jupyter |
# Community Detection with NetworKit
In this notebook we will cover some community detection algorithms implemented in the `community` module of NetworKit. Community detection is concerned with identifying groups of nodes which are significantly more densely connected to each other than to the rest of the network. As ... | github_jupyter |
# Katz Centrality
In this notebook, we will compute the Katz centrality of each vertex in our test datase using both cuGraph and NetworkX. Additionally, NetworkX also contains a Numpy implementation that will used. The NetworkX and cuGraph processes will be interleaved so that each step can be compared.
Notebook Cred... | github_jupyter |
# `Nuqleon.Linq.Expressions.Optimizers`
Provides optimizers for expression trees.
## Reference the library
### Option 1 - Use a local build
If you have built the library locally, run the following cell to load the latest build.
```
#r "bin/Debug/net50/Nuqleon.Linq.Expressions.Optimizers.dll"
```
### Option 2 - Us... | github_jupyter |
```
# british film institute
# import libraries
import rdflib, pandas, pathlib, json
import numpy, uuid, xmltodict, pydash
# define graph and namespace
graph = rdflib.Graph()
name_bfi = rdflib.Namespace('https://www.bfi.org.uk/')
name_wb = rdflib.Namespace('http://wikibas.se/ontology')
name_fiaf = rdflib.Namespac... | github_jupyter |
```
# Load packages
import tensorflow as tf
from tensorflow import keras
import numpy as np
import pandas as pd
import os
import pickle
import time
import scipy as scp
import scipy.stats as scps
from scipy.optimize import differential_evolution
from scipy.optimize import minimize
from datetime import datetime
import ma... | github_jupyter |
# Prepare and Deploy a TensorFlow Model to AI Platform for Online Serving
This Notebook demonstrates how to prepare a TensorFlow 2.x model and deploy it for serving with AI Platform Prediction. This example uses the pretrained [ResNet V2 101](https://tfhub.dev/google/imagenet/resnet_v2_101/classification/4) image clas... | github_jupyter |
# Part 12: Train an Encrypted NN on Encrypted Data
In this notebook, we're going to use all the techniques we've learned thus far to perform neural network training (and prediction) while both the model and the data are encrypted.
In particular, we present our custom Autograd engine which works on encrypted computati... | github_jupyter |
# CodeBert Grid Experiment Evaluation
Nice to see you around! Have a seat.
Would you like a drink? Maybe a cigar?
**A full run of this Notebook takes about 40 minutes on my machine.**
Make sure to have all required dependencies installed - they are listed in the [environment.yml](./environment.yml).
You create a co... | github_jupyter |
#### 1. If you were to plot the point (−1,−7) what would be the correct method? Select the two options that complete the blank spaces in the following statement: 'Starting from the origin ________ and ________'
##### Ans:
- Move 1 units to the left in the horizontal direction
- Move 7 units to the down in the vertica... | github_jupyter |
# Imports
```
import pandas as pd
# import matplotlib.pyplot as plt
# from wordcloud import WordCloud
import os
import numpy as np
```
# Read Data
```
# read data
filepath = os.path.join(
"\\".join([os.getcwd(), "twitterdataFinal2.xlsx"])
)
df = pd.read_excel(filepath,sheet_name=None, dtype='object', index_col=F... | github_jupyter |
# Operation Private Ryan
### Patch the prediction, to gaurantee at least a single child
### Using data leak
All picture must has at least 1 class of prediction
Patch the prediction with safenet
```
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/pytho... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import calmap
```
Data Source: https://www.kaggle.com/aungpyaeap/supermarket-sales
The growth of supermarkets in most populated cities are increasing and market competitions are also high. The dataset is one of the histor... | github_jupyter |
# Smart Queue Monitoring System - Retail Scenario
## Overview
Now that you have your Python script and job submission script, you're ready to request an **IEI Tank-870** edge node and run inference on the different hardware types (CPU, GPU, VPU, FPGA).
After the inference is completed, the output video and stats file... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
from sympy import S, solve
import plotutils as pu
%matplotlib inline
```
# numbers on a plane
Numbers can be a lot more interesting than just a value if you're just willing to shift your perspective a bit.
# integers
When we are dealing with integers we are deali... | github_jupyter |
```
# code by Tae Hwan Jung(Jeff Jung) @graykode, modify by wmathor
import torch
import numpy as np
import torch.nn as nn
import torch.utils.data as Data
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# S: Symbol that shows starting of decoding input
# E: Symbol that shows starting of decoding o... | github_jupyter |
```
import torch
from torchvision import datasets,transforms as T,models
from torch.utils.data import DataLoader
import numpy as np
from collections import OrderedDict
from torch import optim,nn
import matplotlib.pyplot as plt
import torch.nn.functional as F
from sklearn.metrics import precision_score, recall_score, ... | github_jupyter |
```
# Import libraries - REQUIRES pip version 9.0.3
import pandas
import os
from os.path import join
import sys
import scipy.stats
import numpy
import math
import pickle
import copy
import time
import random
import warnings
# Using Cobrapy 0.13.0
import cobra
import cobra.test
from cobra.flux_analysis.sampling import... | github_jupyter |
# Pre-process LINCS L1000 dataset
Pre-processing steps include:
1. Normalize data
2. Partition dataset into training and validation sets
Note: Using python 2 in order to support parsing cmap function
```
import pandas as pd
import os
import numpy as np
from scipy.stats import variation
from sklearn import prep... | github_jupyter |
```
#loading dataset
import pandas as pd
#visualisation
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
# data preprocessing
from sklearn.preprocessing import StandardScaler
# data splitting
from sklearn.model_selection import train_test_split
# data modeling
from sklearn.metrics import confusi... | github_jupyter |
# Quantum pipeline using JAX backend
This performs an exact classical simulation.
```
from jax import numpy as np
def read_data(filename):
labels, sentences = [], []
with open(filename) as f:
for line in f:
labels.append([1, 0] if line[0] == '1' else [0, 1])
sentences.append(l... | github_jupyter |
## DW Finals 2017 solutions <br>
### These solutions are student compiled and might contain errors (especially for qn 1) <br> Credit goes to Team Anonymous on Piazza
```
class MySMClass(sm.SM):
startState=('forward',0.0)
def getNextValues(self, state, inp):
state, orig_angle = state
angle = util.fixAnglePlusM... | github_jupyter |
# PerfForesightConsumerType
```
# Initial imports and notebook setup, click arrow to show
from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType
from HARK.utilities import plotFuncs
from time import clock
import matplotlib.pyplot as plt
import numpy as np
mystr = lambda number : "{:.4f}".format... | github_jupyter |
```
#@title 小波神经网络 { display-mode: "both" }
# 程序实现包含一个小波隐藏层的小波神经网络,小波函数为 morlet 函数
# 单个隐层的小波神经网络的能力与双隐层的普通神经网络相当
# 详见 NN.py 和 NN.ipynb
from tensorflow.examples.tutorials.mnist import input_data
import matplotlib.pyplot as plt
from numpy.linalg import norm
import numpy as np
import time
# 计时装饰器
def timer(func):
def... | github_jupyter |
```
import pandas as pd
import traitlets
import ipywidgets
import bqplot
import numpy as np
states = pd.read_csv("us-states.csv", parse_dates = ["date"])
states.loc
states.iloc
states.head()
states.loc[0:3]
states.iloc[0:3]
states_by_date = states.set_index("date")
states_by_date
states_by_date.loc['2020-01-21':'2020-0... | github_jupyter |
# Gorilla in the data
Reproduce data from this paper:
https://www.biorxiv.org/content/10.1101/2020.07.30.228916v1.full
```
library(tidyverse)
library(jpeg)
download.file('https://classroomclipart.com/images/gallery/Clipart/Black_and_White_Clipart/Animals/gorilla-waving-cartoon-black-white-outline-clipart-914.jpg', 'g... | github_jupyter |
# FMI Hirlam, MET Norway HARMONIE and NCEP GFS comparison demo
In this demo notebook we provide short comparison of using three different weather forecast models:
GFS -- http://data.planetos.com/datasets/noaa_gfs_pgrb2_global_forecast_recompute_0.25degree
HIRLAM -- http://data.planetos.com/datasets/fmi_hirlam_surface
... | github_jupyter |
# Practical Deep Neural Network Performance Prediction for Hyperparameter Optimization
```
%matplotlib inline
from concurrent import futures
from functools import reduce, wraps
from IPython.display import display
import json
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import nu... | github_jupyter |
# Get Started with Notebooks in Azure Machine Learning
Azure Machine Learning is a cloud-based service for creating and managing machine learning solutions. It's designed to help data scientists and machine learning engineers leverage their existing data processing and model development skills and frameworks, and scal... | github_jupyter |
# Validating the 10m Eastern Africa Cropland Mask
## Description
Previously, in the `6_Accuracy_assessment_20m.ipynb` notebook, we were doing preliminary validations on 20m resolution testing crop-masks. The crop-mask was stored on disk as a geotiff. The final cropland extent mask, produced at 10m resolution, is store... | github_jupyter |
# Revisiting Food-Safety Inspections from the Chicago Dataset - A Tutorial (Part 2)
David Lewis, Russell Hofvendahl, Jason Trager
* I switched name order here and put my bio second at the bottom
## 0. Foreward
* probably touch this up
Sustainabilist often works on data that is related to quality assurance and control... | github_jupyter |
# How can we interact with a blockchain?
So, we have all these nodes distributed all over the world which are able to trustlessly save immutable transactions over a distributed ledger. Nice, but: how can we use it?
At first, we need an account for it.
## Getting an address
### At first, let's use the "secrets" libra... | github_jupyter |
# Building Models in PyMC3
Bayesian inference begins with specification of a probability model relating unknown variables to data. PyMC3 provides the basic building blocks for Bayesian probability models:
1. stochastic random variables
2. deterministic variables
3. factor potentials.
A **stochastic random variable... | github_jupyter |
## Test Shock Cooling
Use the Piro et al. (2015) model to fit for multi-band early-time light curves.
```
import pandas as pd
import numpy as np
import scipy.optimize as op
from helper import phys
from allsn_info import get_at2019dge
import emcee
import time
import corner
from multiprocessing import Pool
from helper.... | github_jupyter |
```
"""
created by Arj at 16:28 BST
Investigating the challenge notebook and running it's code.
"""
import matplotlib.pyplot as plt
import numpy as np
from qctrlvisualizer import get_qctrl_style, plot_controls
from qctrl import Qctrl
qctrl = Qctrl()
def simulate_ideal_qubit(
duration=1, values=np.array([np.pi]... | github_jupyter |
# Run constrained emissions-driven ensemble in SSP2-4.5
Theme Song: The Bartender And The Thief<br>
Artist: Stereophonics<br>
Album: Performance and Cocktails<br>
Released: 1998
```
import os.path
import copy
import json
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import pyam
from fair.forw... | github_jupyter |
# Multiparty computation in pytorch demo
Model owner code
## Imports
```
from interface.distributed_interface import DistributedInterface
from shared_variable import SharedVariable
import torch
from torch.autograd import Variable
import spdz
```
## Define an iterface for sending tensors
The interface used in this de... | github_jupyter |
<a href="https://colab.research.google.com/github/unica-ml/ml/blob/master/notebooks/ml06.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Elements of Linear Discriminant Functions
This is the notebook associated to Part 4 of the ML course.
Let's ... | github_jupyter |
# Training LeNet using MNIST and Joey
In this notebook, we will construct and train LeNet using Joey, data from MNIST and the SGD with momentum PyTorch optimizer.
Let's start with importing the prerequisites:
```
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
import... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv('D:/Chandrashekar S/New Volume/Machine learning/Kaggle Competion/titanic/test.csv',index_col=['PassengerId'])
df.head()
#pd.set_option('display.height', 1000)
pd.set_option('display.max_rows', 800)
pd.set... | github_jupyter |
## Machine Learning with Concrete Strength
Concrete strength is affected by factors such as water to cement ratio, raw material quality, the ratio of coarse or fine aggregate, concrete age, concrete compaction, temperature, relative humidity, and other factors during the curing of the concrete. The data includes the f... | github_jupyter |
```
###############################################################
# Script:
# testExc.py
# Usage:
# python testExc.py <input_file> <pass1_file> <output_file>
# Description:
# Build the prediction model based on training data
# Pass 2: prediction based on Sunday exceptions
# Authors:
# Jasmin Nakic, jna... | github_jupyter |
Generate Isoform report for Summary.html #212
Wrapper for isoform_report.R . Based on version:
https://github.com/UCSC-Treehouse/isoform_report/blob/ca339b96e0a9dda1281b0b6b064af29dfd4a3e70/isoform_report.R with slight modification.
Dependencies - the following R libraries are required to run this script:
- dplyr >= ... | github_jupyter |
# 📃 Solution for Exercise M6.04
The aim of this exercise is to:
* verify if a GBDT tends to overfit if the number of estimators is not
appropriate as previously seen for AdaBoost;
* use the early-stopping strategy to avoid adding unnecessary trees, to
get the best statistical performances.
we will use the Calif... | github_jupyter |
```
%matplotlib inline
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('../../../src/')
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from models.chen2017.transforms import *
import datasets.divahisdb as diva
import experiment.data as exd
from datasets.array import Tiles
import ... | github_jupyter |
```
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
#Data can be downloaded from repository
df = pd.read_excel("/Users/guneykan/Desktop/PS1Data.xlsx", index_col=0)
df.head()
# Calculate market return from risk premium, risk free is given as "1+risk-free" that is whhy we substract 1
df["Rm"] = df[... | github_jupyter |
# Logarithm
Here we analyse how accurate are the approximate functions for Logarithm
We compare two methods:
- Newton Raphson
- 6th order HouseHolder
We show how they perform in the context of encrypted computation, show that 6th order HouseHolder is better suited and discuss how to improve initialization of this me... | github_jupyter |
```
%matplotlib inline
```
Tensor
=======
PyTorch에서의 Tensor는 Torch에서와 거의 동일하게 동작합니다.
초기화되지 않은 (5 x 7) 크기의 tensor를 생성합니다:
```
import torch
a = torch.empty(5, 7, dtype=torch.float)
```
평균 0, 분산 1의 정규분포를 따르는 무작위 숫자로 dobule tensor를 초기화합니다:
```
a = torch.randn(5, 7, dtype=torch.double)
print(a)
print(a.size())
```
<... | github_jupyter |
# Tabular data
```
from fastai.gen_doc.nbdoc import *
from fastai.tabular.models import *
```
[`tabular`](/tabular.html#tabular) contains all the necessary classes to deal with tabular data, across two modules:
- [`tabular.transform`](/tabular.transform.html#tabular.transform): defines the [`TabularTransform`](/tabul... | github_jupyter |
```
import sys
sys.path.insert(0,"/home/nico/Documents/TEAR/Codes_TEAR/PythonCodes/LibFolder")
from Lib_GeneralFunctions import *
from Lib_GeneralSignalProcNAnalysis import *
from Lib_SigmoidProcessing import *
import pandas as pd
from matplotlib.gridspec import GridSpec
# Save into a class the
class SSCreference:
... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.