text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# Funciones de Hash
La librería PyCryptoDome tiene funciones de hash para varios algoritmos. Vamos a cargar algunas de ellas. La lista completa está en: https://pycryptodome.readthedocs.io/en/latest/src/hash/hash.html
(Recuerda: MD5 está obsoleto y roto, no se tiene que utilizar en aplicaciones reales)
```
from Cryp... | github_jupyter |
*Python Machine Learning 2nd Edition* by [Sebastian Raschka](https://sebastianraschka.com), Packt Publishing Ltd. 2017
Code Repository: https://github.com/rasbt/python-machine-learning-book-2nd-edition
Code License: [MIT License](https://github.com/rasbt/python-machine-learning-book-2nd-edition/blob/master/LICENSE.tx... | github_jupyter |
<h1> 2c. Loading large datasets progressively with the tf.data.Dataset </h1>
In this notebook, we continue reading the same small dataset, but refactor our ML pipeline in two small, but significant, ways:
1. Refactor the input to read data from disk progressively.
2. Refactor the feature creation so that it is not on... | github_jupyter |
# Diagnosing Coronary Artery Disease
**Data Set Information:**
This dataset contains 76 attributes, but all published experiments refer to using a subset of 14 of them. In particular, the Cleveland database is the only one that has been used by ML researchers to this date. The "goal" field refers to the presence of h... | github_jupyter |
```
import numpy as np
import torch
import matplotlib.pyplot as plt
print(torch.__version__)
print(torch.cuda.is_available())
```
# Model - Manual
- Cell: $y_t = tanh(W_x \cdot X_t + W_y \cdot y_{t-1} + b)$
- System
- $y_0 = tanh(W_x \cdot X_0)$
- $y_1 = tanh(W_x \cdot X_1 + W_y \cdot y_0)$
<img src="./asset... | github_jupyter |
# Data preprocessing
## Load data
```
import gzip
interactions = {}
data = []
# Load data
org_id = '9606' # Change to 9606 for Human
with gzip.open(f'data/{org_id}.protein.links.v11.0.txt.gz', 'rt') as f:
next(f) # Skip header
for line in f:
p1, p2, score = line.strip().split()
if float(score... | github_jupyter |
# Notebook for Codementor Machine Learning Class 2
## U.S. Dept. of Education College Scorecard
### Topics
* Data Science career discussion
* Incorporate insights from data characterization (Class 1)
* Principle Components Analysis (PCA)
* K-means clustering on transformed (PCA) data
* Provide a prototype us... | github_jupyter |
<a href="https://colab.research.google.com/github/jonkrohn/ML-foundations/blob/master/notebooks/5-probability.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Probability & Information Theory
This class, *Probability & Information Theory*, introdu... | github_jupyter |
## **Stage 2** on **miniImageNet**:Ablation Studies results
#### Note: This scripts shows the results of our baseline, which is SEGA **without semantic using** and just with AttentionBasedBlock from DynamicFSL(Gidaris&Komodakis, CVPR 2018)
```
import sys
import torch
sys.path.append("..")
from traincode import train_s... | 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 |
```
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
from simtk import unit
from simtk import openmm as omm
from simtk.openmm import app
import molsysmt as msm
from tqdm import tqdm
```
# Alanine dipeptide in explicit solvent
## With OpenMM from scratch
```
from molecular_systems... | github_jupyter |
# Feedforward Neural Networks
This notebook accompanies the Intro to Deep Learning workshop run by Hackers at Cambridge
## Importing Data and Dependencies
First, we will import the dependencies - **numpy**, the python linear algebra library, **pandas** to load and preprocess the input data and **matplotlib** for vi... | github_jupyter |
```
# Enable in-notebook generation of plots
%matplotlib inline
```
# Experiments collected data
Data required to run this notebook are available for download at this link:
https://www.dropbox.com/s/q9ulf3pusu0uzss/SchedTuneAnalysis.tar.xz?dl=0
This archive has to be extracted from within the LISA's results folder.... | github_jupyter |
```
import os
os.chdir('..')
import h5py
import numpy as np
import cartopy.crs as ccrs
from notebooks import config
import numpy as np
from utils.imgShow import imgShow
import matplotlib.pyplot as plt
from utils.geotif_io import readTiff
from utils.transform_xy import coor2coor
from utils.mad_std import mad_std
from sc... | github_jupyter |
## Module 2.4: Working with Auto-Encoders in Keras (A Review)
We implementing a denoising auto-encoder in the Keras functional API. In this module we will pay attention to:
1. Using the Keras functional API for defining models.
2. Understanding denoising auto-encoders.
A denoising auto-encoder is at base just a norm... | github_jupyter |
<center><img src="https://github.com/pandas-dev/pandas/raw/master/web/pandas/static/img/pandas.svg" alt="pandas Logo" style="width: 800px;"/></center>
# Introduction to Pandas
---
## Overview
1. Introduction to pandas data structures
1. How to slice and dice pandas dataframes and dataseries
1. How to use pandas for e... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | github_jupyter |
```
import numpy as np
import pandas as pd
amplifiers = np.genfromtxt('amplifiers_0.csv',delimiter=',').astype(int)
print(amplifiers)
normals = 1-amplifiers
print(normals)
weights_biased = np.atleast_2d(np.genfromtxt('weights-biased_0.csv', delimiter=','))
weights_unbiased = np.atleast_2d(np.genfromtxt('weights-unbiase... | github_jupyter |
```
'''
This notebook is used to merge exported data from Reaxys,
clean the data, filter, tokenize and preprocess the dataset
for the training of the Enzymatic Transformer available at
https://github.com/reymond-group/OpenNMT-py
The environment is detailed on GitHub.
Initial .xls Reaxys extr... | github_jupyter |
# Parameters
MLlib `Estimators` and `Transformers` use a uniform API for specifying parameters.
A Param is a named parameter with self-contained documentation. A ParamMap is a set of (parameter, value) pairs.
There are two main ways to pass parameters to an algorithm:
- Set parameters for an instance. E.g., if `lr` ... | github_jupyter |
## MIDS UC Berkeley, Machine Learning at Scale
__W261-1__ Summer 2016
__Week 7__: SSSP
__Name__
name@ischool.berkeley.edu
July 1, 2016
***
<h1 style="color:#021353;">General Description</h1>
<div style="margin:10px;border-left:5px solid #eee;">
<pre style="font-family:sans-serif;background-color:... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
f... | github_jupyter |
<a href="https://colab.research.google.com/github/gamesMum/Leukemia-Diagnostics/blob/master/Leukemia_Diagnosis_.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Leukemia Diagnostic Model
**Classification of Acute Leukemia using Pretrained Deep Con... | github_jupyter |
# The Rational Speech Act framework
Human language depends on the assumption of *cooperativity*, that speakers attempt to provide relevant information to the listener; listeners can use this assumption to reason *pragmatically* about the likely state of the world given the utterance chosen by the speaker.
The Rational... | github_jupyter |
# Miscellaneous Python things
In this session, we'll talk about:
- More control flow tools: [`try/except`](https://docs.python.org/3/tutorial/errors.html), [`break`](https://docs.python.org/3/reference/simple_stmts.html#the-break-statement) and [`continue`](https://docs.python.org/3/reference/simple_stmts.html#the-co... | github_jupyter |
# Mutual Funds
https://www.nerdwallet.com/blog/investing/what-are-the-different-types-of-mutual-funds/
Equity funds
Bond funds
Money market funds
Balanced funds
Index funds
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import math
import warnings
warnings.f... | github_jupyter |
Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All).
Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as we... | github_jupyter |
# Visualizing the word2vec embeddings
In this example, we'll train a word2vec model using Gensim and then, we'll visualize the embedding vectors using the `sklearn` implementation of [t-SNE](https://lvdmaaten.github.io/tsne/). t-SNE is a dimensionality reduction technique, which will help us visualize the multi-dimens... | github_jupyter |
# Algorithmic Complexity
Notes by J. S. Oishi
```
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
```
## How long will my code take to run?
Today, we will be concerned *solely* with **time complexity**.
Formally, we want to know $T(d)$, where $d$ is any given dataset and $T(d)$ gives the *... | github_jupyter |
<a href="https://colab.research.google.com/github/DarekGit/FACES_DNN/blob/master/notebooks/06_01_FDDB_TEST.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
---
[Spis treści](https://github.com/DarekGit/FACES_DNN/blob/master/notebooks/Praca_Dyplomowa... | github_jupyter |
```
%pylab inline
```
# More Examples
## Additive model
Example taken from JCGM 101:2008, Clause 9.2.
This example considers the additive model
$$ Y = X_1 + X_2 + X_3 + X_4 $$
for three different sets of PDFs $g_{x_i}(\xi_i)$ assigned to the input quantities $X_i$, regarded as independent.
#### Taks 1
Assume th... | github_jupyter |
# Base enem 2016
## Predição se o aluno é treineiro.
## Primeiro teste:
### * Somente a limpeza dos dados
### * Sem balanceamento
### * Regressão Logística
Score obtido: 87.921225
```
import pandas as pd
import numpy as np
import warnings
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_mode... | github_jupyter |
# New Horizons launch and trajectory
Main data source: Guo & Farquhar "New Horizons Mission Design" http://www.boulder.swri.edu/pkb/ssr/ssr-mission-design.pdf
```
import matplotlib.pyplot as plt
plt.ion()
from astropy import time
from astropy import units as u
from poliastro.bodies import Sun, Earth, Jupiter
from p... | github_jupyter |
```
import pandas as pd
import math, random
all_data = pd.read_csv("sensor_data_600.txt", delimiter=" ", header=None, names = ("date","time","ir","z"))#lidarのセンサ値は「z」に
data = all_data.sample(3000).sort_values(by="z").reset_index() #1000個だけサンプリングしてインデックスを振り直す
data = pd.DataFrame(data["z"])
##負担率の初期化##
K = 3 #クラスタ数
... | github_jupyter |
<a href="https://colab.research.google.com/github/PacktPublishing/Hands-On-Computer-Vision-with-PyTorch/blob/master/Chapter04/Image_augmentation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import imgaug.augmenters as iaa
from torchvision imp... | 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 |
# Experiment 4: Source identification. (N-class classification.)
Evaluate performance on a harder problem: identifying which source an image came from. This is harder than source verification, because you must decide which of N sources an image is from.
**Caution**: with small # of distinct compression features (... | github_jupyter |
```
import numpy as np
import xarray as xr
import parambokeh
import geoviews as gv
import cartopy.crs as ccrs
from earthsim.grabcut import GrabCutDashboard
gv.extension('bokeh')
```
The GrabCut algorithm provides a way to annotate an image using polygons or lines to demark the foreground and background. The algorithm... | github_jupyter |
```
import osmnx as ox, networkx as nx, pandas as pd, geopandas as gpd, time, matplotlib.pyplot as plt, math, ast, re
import matplotlib.cm as cm
from matplotlib.collections import PatchCollection
from descartes import PolygonPatch
from shapely.geometry import Point, Polygon, MultiPolygon
import statsmodels.api as sm, n... | github_jupyter |
```
#!pip install graphviz --user
#!echo $PYTHONPATH
#!ls -ltr /eos/user/n/nmangane/.local/lib/python2.7/site-packages/
#!export PATH=/eos/user/n/nmangane/.local/lib/python2.7/site-packages/:$PATH
from __future__ import print_function
import ROOT
from IPython.display import Image, display, SVG
#import graphviz
ROOT.ROO... | github_jupyter |
# Bring Your Own Model を SageMaker で hosting する
* 先程学習したモデルを Notebook インスタンスで読み込み、改めて tensorflow で save し、自分で作成したモデルとする
* 自作モデルを SageMaker で hosting & 推論する
## 処理概要
* 先程学習したモデルを Notebook インスタンスにダウンロード
* TensorFlow で読み込み、推論し、改めて保存し直す
* 保存しなおしたモデルを S3 にアップロードする
* モデルを hosting する

```
# notebook のセル... | github_jupyter |
## The CSV File Format
One simple way to store data in a text file is to write the data as a series of values separated by commas, called comma-separated values.
The CSV files were downloaded from: https://github.com/ehmatthes/sitka_weather_hx
`csv.reader()` creates a reader object associated with the file `f`
`nex... | github_jupyter |
This notebook was prepared by [Rishi Rajasekaran](https://github.com/rishihot55). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# Solution Notebook
## Problem: Find all valid combinations of n-pairs of parentheses.
* [Constraints](#Constraints)
* [Test Cases](#... | github_jupyter |
<a href="https://colab.research.google.com/github/apache/beam/blob/master/examples/notebooks/get-started/try-apache-beam-java.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Try Apache Beam - Java
In this notebook, we set up a Java development en... | github_jupyter |
# Asset Classes and Financial Instruments
$Table-2.1$
- The money market
1. Treasury bills (T-bills)
2. Certificates of deposit (CD)
3. Commercial paper
4. Bankers' acceptances
5. Eurodollars
6. Repos and reverses
7. Federal funds
8. Brokers' calls
9. LIBOR rate
- Indexes
1. Dow Jones averages
2... | github_jupyter |
# Solr Client
```
from ltr.client import SolrClient
client = SolrClient()
import numpy as np
```
# Download & Build Index (run once)
If you don't already have the downloaded dependencies; if you don't have TheMovieDB data indexed run this
```
from ltr import download
corpus='http://es-learn-to-rank.labs.o19s.com/... | github_jupyter |
# Lab 05 : Train with mini-batches -- exercise
```
# For Google Colaboratory
import sys, os
if 'google.colab' in sys.modules:
from google.colab import drive
drive.mount('/content/gdrive')
file_name = 'minibatch_training_exercise.ipynb'
import subprocess
path_to_file = subprocess.check_output('find ... | github_jupyter |
```
import pandas as pd
import numpy as np
import math
import pickle
import matplotlib.pyplot as plt
%matplotlib inline
def loading_data(filepath):
#loading data
ml = pd.read_csv(filepath, header=None)
ml.columns = ['User','Item','ItemRating']
return ml
def create_interaction_cov(ml):
# creating mat... | github_jupyter |
# Pandas
Pandas is a library providing high-performance, easy-to-use data structures and data analysis tools. The core of pandas is its *dataframe* which is essentially a table of data. Pandas provides easy and powerful ways to import data from a variety of sources and export it to just as many. It is also explicitly ... | github_jupyter |
```
from traitlets.config.manager import BaseJSONConfigManager
import jupyter_core
# path = "/Users/i.oseledets/anaconda2/envs/teaching/etc/jupyter/nbconfig"
cm = BaseJSONConfigManager(config_dir=path)
cm.update("livereveal", {
"theme": "sky",
"transition": "zoom",
"start_slide... | github_jupyter |
```
%%javascript
// Disables truncation of output window
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
# Config
output_dir = "trials1"
trial_type = "DEFAULT"
analysis_type = "temporal"
num_trials = 100
options = "-output_dir %s" % output_dir
options += " -type %s" % trial_type
opti... | github_jupyter |
# The GLM, part 2: inference
In this notebook, we'll continue with the GLM, focusing on statistical tests (i.e., inference) of parameters. Note that there are two notebooks this week: this one, `glm_part2_inference.ipynb`, and `design_of_experiments.ipynb`. Please do this one first.
Last week, you learned how to estim... | github_jupyter |
```
```
# Classification result tuning and Plots
```
import os, sys
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns ; sns.set()
from google.colab import drive
drive.mount('/content/drive')
sys.path.append("/content/drive/MyDrive/GSOC-NMR-project/Work/Notebooks")
from auxillary_functions imp... | github_jupyter |
```
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import numpy as np
import pickle
import matplotlib.pyplot as plt
from tqdm import tqdm
from tensorflow.keras.layers import Input
from tensorflow.keras.models import load_model
from keras.datasets import mnist
from architectures.protoshotxai import ProtoShotXAI
from... | github_jupyter |
```
from notebook.services.config import ConfigManager
cm = ConfigManager()
cm.update('livereveal', {
'width': 1024,
'height': 768,
'scroll': True,
})
import pandas as pd
import pylab as plt
import pystan
import seaborn as sns
import numpy as np
%matplotlib inline
import warnings
warnings.simpl... | github_jupyter |
```
import math
import cv2
import numpy as np
import matplotlib.pyplot as plt
import import_ipynb
import matplotlib.patches as patches
import os
import torch
import torchvision.transforms as transforms
import skimage
from options.generate_options import GenerateOptions
from data.data_loader import CreateDataLoader
fro... | github_jupyter |
# 1-6.1 Intro Python
## Nested Conditionals
- Nested Conditionals
- Escape Sequence print formatting "\\"
><font size="5" color="#00A0B2" face="verdana"> <B>Student will be able to</B></font>
- create nested conditional logic in code
- format print output using escape "\\" sequence
#
<font size="6" color... | github_jupyter |
```
%cd ..
```
# Prepare USPTO-sm and USPTO-lg for template-relevance prediction
```
# if not allready in repo download temprel-fortunato
#export
import requests
def download_temprel_repo(save_path, chunk_size=128):
"downloads the template-relevance master branch"
url = "https://gitlab.com/mefortunato/templ... | github_jupyter |
From a design perspective, deep hierarchies of classes can be cumbersome and make change a lot harder since the entire hierarchy has to be taken into account. Python offers a few mechanism to avoid this, and make the class desing leaner.
In order to ensure that all cells in this notebook can be evaluated without error... | github_jupyter |
<a href="https://colab.research.google.com/github/AmitHasanShuvo/Machine-Learning-Projects/blob/master/Experiment_with_Filters_and_Pools.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import cv2
import numpy as np
from scipy import misc
i = mis... | github_jupyter |
```
from collections import Counter
import math, random
#아이들을 만들어서 조건부 확률을 계산해 보자
def random_kid():
return random.choice(["boy", "girl"])
kid_test_list = [random_kid() for i in range(10)]
kid_test_list #random_kid 함수는 boy와 girl 두개의 값중에 하는 램덤하게 추출함
both_girls = 0
older_girl = 0
either_girl = 0
random.seed(0)
for _... | github_jupyter |
```
pip install tifffile
import cv2
import numpy as np
import matplotlib.pyplot as plt
import os
from tifffile import imread
from PIL import Image
from google.colab.patches import cv2_imshow
import random
import torch
from torch.utils.data import DataLoader, Dataset
from torch import nn
from tqdm import tqdm
from torch... | github_jupyter |
## This notebook is used to generate the finalized version of the classifier, to simply feature transformation into the final form, and to test that the results are the same
Most of the code comes from operational_classifier.
```
import pandas as pd
import numpy as np
import pickle
import sys
#reload(sys)
#sys.setdef... | github_jupyter |
<div style="color:#777777;background-color:#ffffff;font-size:12px;text-align:right;">
prepared by Abuzer Yakaryilmaz (QuSoft@Riga) | November 07, 2018
</div>
<table><tr><td><i> I have some macros here. If there is a problem with displaying mathematical formulas, please run me to load these macros.</i></td></td></table... | github_jupyter |
```
import numpy as np
import pandas as pd
import pandas_profiling
import matplotlib.pyplot as plt
import scipy as stats
import matplotlib.ticker as ticker
import seaborn as sns
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error,mean_squared_error,r2_score
from sklearn.mod... | github_jupyter |
```
from climpy.utils.refractive_index_utils import get_dust_ri
import climpy.utils.mie_utils as mie
from climpy.utils.aerosol_utils import get_Kok_dust_emitted_size_distribution
from climpy.utils.wrf_chem_made_utils import derive_m3s_from_mass_concentrations, get_wrf_sd_params
from climpy.utils.netcdf_utils import con... | github_jupyter |
```
from tqdm.notebook import tqdm
import json
import collections
import pandas as pd
import numpy as np
import glob
```
## Load JSON files
```
sorted(glob.glob('./../data/*/*.json'))
with open('./../data/projects/project_ids.json', 'rb') as f:
project_ids = json.load(f)
len(set(project_ids))
with open('./../data... | github_jupyter |
<img src="../Pierian-Data-Logo.PNG">
<br>
<strong><center>Copyright 2019. Created by Jose Marcial Portilla.</center></strong>
# Full Artificial Neural Network Code Along
In the last section we took in four continuous variables (lengths) to perform a classification. In this section we'll combine continuous and categori... | github_jupyter |
# A brief, basic introduction to Python for scientific computing - Chapter 1
## Background/prerequisites
This is part of a brief introduction to Python; please find links to the other chapters and authorship information [here](https://github.com/MobleyLab/drug-computing/blob/master/other-materials/python-intro/README.... | github_jupyter |
<!--
Copyright 2022 Kenji Harada
-->
# Finite-Size Scaling method by neural network
The finite-size scaling (FSS) method is a powerful tool for getting universal information of critical phenomena. It estimates universal information from observables of critical phenomena at finite-size systems. In this document, we will... | github_jupyter |
This notebook can be run in two ways:
- Run all cells from beginning to end. However, this is a time-consuming process that will take about 10hrs. Note that the maximal runtime of a colab notebook is 12hrs. If a section is time-consuming, then the estimated time will be reported at the beginning of the section.
- Run... | github_jupyter |
# Table of contents:
* [The Paillier Cryptosystem](#paillier)
* [Key Generation](#keygeneration)
* [Random prime numbers](#twop)
* [Calculate $l$, $g$ and $\mu$](#lgmu)
* [Encryption function](#encryption)
* [Decryption function](#decryption)
Author: [Sebastià Agramunt Puig](https://gi... | github_jupyter |
```
%pwd
%cd ..
import matplotlib.pyplot as plt
import pickle
import numpy as np
import tools
from pylab import *
import matplotlib.animation as animation
import matplotlib as mpl
import numpy as np
import os
import glob
import standard.analysis as sa
import tools
import matplotlib.pyplot as plt
import task
import tens... | github_jupyter |
# Part 1 - Introduction to Grid
##### Grid is a platform to **train**, **share** and **manage** models and datasets in a **distributed**, **collaborative** and **secure way**.
Grid platform aims to be a secure peer to peer platform. It was created to use pysyft's features to perform federated learning pr... | github_jupyter |
# Library
```
import numpy as np
import torch
import torch.nn as nn
from utils import *
from dataset import CollisionDataset
from torch.utils.data import DataLoader
```
# Model
```
class ResidualMLP(nn.Module):
def __init__(self, in_dim, out_dim):
super(ResidualMLP, self).__init__()
self.hidden... | github_jupyter |
# Sparkify Project - Feature Engineering and Selection
This notebook is based on the work of Sparkify_data_analysis.ipynb. After the data is inspected and different behaviors between the user who churned and who did not are analyzed, further features are cr
```
# import libraries
import datetime
import numpy as np
im... | github_jupyter |
## One Dimensional Motion
```
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as tck
import matplotlib.patches as patches
%matplotlib inline
%config InlineBackend.figure_format = 'png2x'
```
## Velocity
> The [velocity](https://en.wikipedia.org/wiki/Velocity) of an o... | github_jupyter |
```
import sys
sys.path.insert(0,'C:\\Users\\Syahrir Ridha\\PycharmProjects\\NET_Solver\\')
import numpy as np
import torch
from geometry import *
from utils import Plot_Grid
from solver import *
from models import *
from mesh import *
from boundary import *
import matplotlib.pyplot as plt
%matplotlib inline
from model... | github_jupyter |
# This notebook contains a resumed table of the q-learners results. The results are the ones evaluated on the test set, with the learned actions (without learning on the test set)
```
# Basic imports
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import sys
from time import time
impor... | github_jupyter |
## The Transformer Network for the Traveling Salesman Problem
Xavier Bresson, Thomas Laurent, Feb 2021<br>
Arxiv : https://arxiv.org/pdf/2103.03012.pdf<br>
Talk : https://ipam.wistia.com/medias/0jrweluovs<br>
Slides : https://t.co/ySxGiKtQL5<br>
This code visualizes transformer and concorde solutions
```
##########... | github_jupyter |
# Intro to Hidden Markov Models (optional)
---
### Introduction
In this notebook, you'll use the [Pomegranate](http://pomegranate.readthedocs.io/en/latest/index.html) library to build a simple Hidden Markov Model and explore the Pomegranate API.
<div class="alert alert-block alert-info">
**Note:** You are not require... | github_jupyter |
# TSP's Parameters Sensitivity
### Information and Decision Systems Group<br>University of Chile
Implementation of the TSP's parameters sensitivity analysis presented by [Gonzalez et al. (2021)](https://arxiv.org/pdf/2110.14122.pdf).
```
import sys
import numpy as np
import matplotlib.pyplot as plt
sys.path.insert(1,... | github_jupyter |
# Coords 1: Getting Started with astropy.coordinates
## Authors
Erik Tollerud, Kelle Cruz, Stephen Pardy, Stephanie T. Douglas
## Learning Goals
* Create `astropy.coordinates.SkyCoord` objects using names and coordinates
* Use SkyCoord objects to become familiar with object oriented programming (OOP)
* Interact with ... | github_jupyter |
```
1 Environment, 环境
2 Hyper Parameters, 超参数
3 Training Data, 训练数据
4 Prepare for Training, 训练准备
4.1 mx Graph Input, mxnet图输入
4.2 Construct a linear model, 构造线性模型
4.3 Mean squared error, 损失函数:均方差
5 Start training, 开始训练
6 Regression result, 回归结果
```
---
# Environment, 环境
```
from __fut... | github_jupyter |
# Online Tracking
Given a list of images, we want to track players and the ball and gather their trajectories. Our model initializes several tracklets based on the detected boxes in the first image. In the following ones, the model links the boxes to the existing tracklets according to:
1. their distance measured by... | github_jupyter |
# New LRISr Mark4 detector
```
# imports
import os, glob
import numpy as np
from matplotlib import pyplot as plt
from astropy.io import fits
from pypeit.core import parse
from pypeit.display import display
from pypeit import flatfield
```
# Load data
```
dpath = '/scratch/REDUX/Keck/LRIS/new_LRISr'
rpath = os.pat... | github_jupyter |
[](http://rpi.analyticsdojo.com)
<center><h1>Boston Housing - Feature Selection and Importance</h1></center>
<center><h3><a href = 'http://rpi.analyticsdojo.com'>rpi.analyticsdojo.com</a></h3></center>
##... | github_jupyter |
# Partial Differential Equation Training
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
```
## 1 Linear Convection
The 1-D Linear Convection equation is the simplest, most basic model that can be used to learn something about PDE. Here it is:
$\frac{\partial u}{\partial t}+c\frac{\partial ... | github_jupyter |
# Application: A Face Detection Pipeline
```
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import numpy as np
from skimage import data, color, feature
import skimage.data
image = color.rgb2gray(data.chelsea())
hog_vec, hog_vis = feature.hog(image, visualise=True)
fig, ax = plt.s... | github_jupyter |
## Weekly Assignment 6
### Brandon Owens and Loan Pham
### Q. 1
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import GridSearchCV
fr... | github_jupyter |
# Noisy Duelling Double Deep Q Learning - A simple ambulance dispatch point allocation model
## Reinforcement learning introduction
### RL involves:
* Trial and error search
* Receiving and maximising reward (often delayed)
* Linking state -> action -> reward
* Must be able to sense something of their environment
* I... | 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 applicable law or agreed t... | github_jupyter |
```
import keras,os
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPool2D , Flatten
# from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import imageio
import glob
import matplotlib.pyplot as plt
from keras.utils import to_categorical
from sklearn.model_selection... | github_jupyter |
```
import importlib.util
try:
import cirq
except ImportError:
print("installing cirq...")
!pip install --quiet cirq
print("installed cirq.")
try:
import quimb
except ImportError:
print("installing cirq[contrib]...")
!pip install --quiet cirq[contrib]
print("installed cirq[contrib].")
... | github_jupyter |
# Example 02: General Use of XGBoostClassifierHyperOpt
[](https://colab.research.google.com/github/slickml/slick-ml/blob/master/examples/optimization/example_02_XGBoostClassifierHyperOpt.ipynb)
### Google Colab Configuration
```
# !git clone ht... | github_jupyter |
```
!pip install git+https://github.com/huggingface/transformers.git
from transformers import DistilBertTokenizerFast
from transformers import TFDistilBertForSequenceClassification
import tensorflow as tf
import json
#### Import data and prepare data
!wget --no-check-certificate \
https://storage.googleapis.com/la... | github_jupyter |
```
import fastbook
from fastbook import *
from utils import *
from fastai.vision.widgets import *
#Gathering Data
path = Path('vehicletypes')
vehicle_type = 'car', 'truck', 'bus', 'aeroplane', 'ship'
path = Path('vehicletypes')
if not path.exists():
path.mkdir()
for o in vehicle_type:
print('Collecting: ', o... | github_jupyter |
# Data Manipulation with Pandas
```
import pandas as pd
pd.set_option('max_rows', 10)
```
## Categorical Types
* Pandas provides a convenient `dtype` for reprsenting categorical, or factor, data
```
c = pd.Categorical(['a', 'b', 'b', 'c', 'a', 'b', 'a', 'a', 'a', 'a'])
c
c.describe()
c.codes
c.categories
```
* By ... | github_jupyter |
```
#hide
%load_ext autoreload
%autoreload 2
# default_exp seasonal
```
# Seasonal Components
> This module contains functions to define the seasonal components in a DGLM. These are *harmonic* seasonal components, meaning they are defined by sine and cosine functions with a specific period. For example, when working ... | github_jupyter |
# Analysis of Cosine-Similarity Model
In this notebook, a parsimonious version of K-Nearest Neighbors (dubbed Cosine-Similarity Model) is proposed that results in a slightly higher accuracy than standard K-Nearest Neighbor models, along with a 2 times (or greater) classification speedup. The models's speed and accura... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.