code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Predicting Remaining Useful Life (advanced)
<p style="margin:30px">
<img style="display:inline; margin-right:50px" width=50% src="https://www.featuretools.com/wp-content/uploads/2017/12/FeatureLabs-Logo-Tangerine-800.png" alt="Featuretools" />
<img style="display:inline" width=15% src="https://upload.wikimedi... | github_jupyter |
# Tutorial Machine Learning
EXERCÍCIO 1_Iris Flower B
### 1. Livrarias a utilizar
```
import numpy as np
import pandas as pd
```
### 2. Importação dos dados
#### Importamos o dataset para iniciar a análise
```
iris=pd.read_csv('IRIS.csv')
```
#### Visualizamos os 5 primeiros dados do dataset
```
print(iris.head(... | github_jupyter |
```
import source_synphot.passband
import source_synphot.io
import source_synphot.source
import astropy.table as at
from collections import OrderedDict
import pysynphot as S
%matplotlib notebook
%pylab
def myround(x, prec=2, base=.5):
return round(base * round(float(x)/base),prec)
models = at.Table.read('ckmodels.txt... | github_jupyter |
# In-Class Coding Lab: Web Services and APIs
### Overview
The web has long evolved from user-consumption to device consumption. In the early days of the web when you wanted to check the weather, you opened up your browser and visited a website. Nowadays your smart watch / smart phone retrieves the weather for you and... | github_jupyter |
```
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import os
import numpy as np
from hangul.read_data import load_data, load_all_labels, load_images
import umap
import pandas as pd
from sklearn.decomposition import PCA, FastICA
from scipy.stats import gaussian_kde
from bokeh.palettes import Greys2... | github_jupyter |
```
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from bs4 import BeautifulSoup
import os
import unicodedata
```
## Reviews from Roger Ebert
```
# Reading Roger Ebert review from text files online
import requests
import glob
folder = 'ebert_reviews'
#... | github_jupyter |
```
#export
from local.torch_basics import *
from local.test import *
from local.layers import *
from local.data.all import *
from local.notebook.showdoc import show_doc
from local.optimizer import *
from local.learner import *
#default_exp callback.hook
```
# Model hooks
> Callback and helper function to add hooks i... | github_jupyter |
## Demo of 1D regression with an Attentive Neural Process with Recurrent Neural Network (ANP-RNN) model
This notebook will provide a simple and straightforward demonstration on how to utilize an Attentive Neural Process with a Recurrent Neural Network (ANP-RNN) to regress context and target points to a sine curve.
Fi... | github_jupyter |
<img src="images/usm.jpg" width="480" height="240" align="left"/>
# MAT281 - Laboratorio N°02
## Objetivos del laboratorio
* Reforzar conceptos básicos de clasificación.
## Contenidos
* [Problema 01](#p1)
<a id='p1'></a>
## I.- Problema 01
<img src="https://www.xenonstack.com/wp-content/uploads/xenonstack-credi... | github_jupyter |
# Venture Funding with Deep Learning
You work as a risk management associate at Alphabet Soup, a venture capital firm. Alphabet Soup’s business team receives many funding applications from startups every day. This team has asked you to help them create a model that predicts whether applicants will be successful if fun... | github_jupyter |
<a href="https://colab.research.google.com/github/rawalk/DS-Unit-2-Linear-Models/blob/master/DSPT6_LS_DS_224.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Lambda School Data Science
*Unit 2, Sprint 2, Module 4*
---
# Classification Metrics
- g... | github_jupyter |
# Environmental Covariates
Datasets listed in [Supplementary_Data_File_1._environmental_covariates - Google Sheet](https://docs.google.com/spreadsheets/d/1hPw9G1A34SnlbDJ8sk3LYfwgoLN0Gbail2xdNb7viGc/edit#gid=106509025).
```
#default_exp data.env
#export
import os, sys
import shutil, io, subprocess
from tqdm import t... | github_jupyter |
# T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid
An adversary may perform shell escapes or exploit vulnerabilities in an application with the setsuid or setgid bits to get code running in a different user’s context. On Linux or macOS, when the setuid or setgid bits are set for an application, the appl... | github_jupyter |
# Deep Neural Network for Image Classification: Application
When you finish this, you will have finished the last programming assignment of Week 4, and also the last programming assignment of this course!
You will use use the functions you'd implemented in the previous assignment to build a deep network, and apply i... | github_jupyter |
## assignment 04: Decision Tree construction
```
# If working in colab, uncomment the following line
# ! wget https://raw.githubusercontent.com/girafe-ai/ml-mipt/21f_basic/homeworks_basic/assignment0_04_tree/tree.py -nc
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
from sklearn.base import... | github_jupyter |
# Homework 2
## Due: January 30, 2018, 8 a.m.
Please give a complete, justified solution to each question below. A single-term answer without explanation will receive no credit.
Please complete each question on its own sheet of paper (or more if necessary), and upload to [Gradsescope](https://gradescope.com/).
$$
\... | github_jupyter |
# Import Libraries
```
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
# Train Phase transformations
train_transforms = transforms.Compose([
# transfo... | github_jupyter |
```
import matplotlib.pyplot as plt
x = [1, 2.1, 0.4, 8.9, 7.1, 0.1, 3, 5.1, 6.1, 3.4, 2.9, 9]
y = [1, 3.4, 0.7, 1.3, 9, 0.4, 4, 1.9, 9, 0.3, 4.0, 2.9]
plt.scatter(x,y, color='red')
w = [0.1, 0.2, 0.4, 0.8, 1.6, 2.1, 2.5, 4, 6.5, 8, 10]
z = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
plt.plot(z, w, color='lightblue', linewidt... | github_jupyter |
```
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision
import torchvision.transforms as transforms
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data import Dataset, IterableDataset, DataLoader
# impor... | github_jupyter |
<center><h1> Sorting Algorithms Visualizer.</h1></center>
<center><h3>Made Using Matplotlib Animation.</h3></center>
<ceter><img src='https://miro.medium.com/max/1400/0*qwkWXc-wzW2D8ggV.jpg'></center>
### Sorting Algorithms
* Quick Sort
* Merge Sort
* Insertion Sort
* Selection Sort
* Bubble Sort
# Importing Librari... | github_jupyter |
```
import pandas as pd
import sklearn as sk
import json
import ast
import pickle
import math
import matplotlib.pyplot as plt
df = pd.read_json('/data/accessible_POIs/great-britain-latest.json')
df.loc[:,'id'] = df['Node'].apply(lambda x: dict(x)['id'])
df.loc[:,'access'] = df['Node'].apply(lambda x: dict(x)['tags'].ge... | github_jupyter |
### Image Captioning
To perform image captioning we are going to apply an approach similar to the work described in references [1],[2], and [3]. The approach applied here uses a recurrent neural network (RNN) to train a network to generate image captions. The input to the RNN is comprised of a high-level representatio... | github_jupyter |
```
import numpy as np
import sys
```
# The Basics
```
a = np.array([1,2,3], dtype='int32')
print(a)
b = np.array([[1.0,2.0,3.0],[4.0,5.0,6.0]])
print(b)
#Get Dimension
a.ndim
#Get Shape
a.shape
b.shape
#Get Type
a.dtype
#Get size
a.itemsize
#Get Total Size
a.nbytes
b.itemsize
```
## Accessing / Changing specific e... | github_jupyter |
# Classifying Fashion-MNIST
Now it's your turn to build and train a neural network. You'll be using the [Fashion-MNIST dataset](https://github.com/zalandoresearch/fashion-mnist), a drop-in replacement for the MNIST dataset. MNIST is actually quite trivial with neural networks where you can easily achieve better than 9... | github_jupyter |
#### New to Plotly?
Plotly's Python library is free and open source! [Get started](https://plotly.com/python/getting-started/) by downloading the client and [reading the primer](https://plotly.com/python/getting-started/).
<br>You can set up Plotly to work in [online](https://plotly.com/python/getting-started/#initiali... | github_jupyter |
# Process an interferogram with ASF HyP3
https://hyp3-docs.asf.alaska.edu/using/sdk/
## Search for scenes
scenes over grand mesa, colorado using https://asf.alaska.edu/api/
```
import requests
import shapely.geometry
roi = shapely.geometry.box(-108.3,39.2,-107.8,38.8)
polygonWKT = roi.wkt
baseurl = "https://api.d... | github_jupyter |
# Activity #1: MarketMap
* another way to visualize mappable data
## 1.a : explore the dataset
```
# our usual stuff
%matplotlib inline
import pandas as pd
import numpy as np
#!pip install xlrd # JPN, might have to run this
# note: this is quering from the web! How neat is that??
df = pd.read_excel('https://query.d... | github_jupyter |
```
import sys
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0" #for training on gpu
from scipy import signal
import tensorflow as tf
import matplotlib.pyplot as plt
import numpy as np
import pickle
import time
from random import shuffle
from tensorflow import keras
from tensorflow.keras.utils import to_categorical
fr... | github_jupyter |
```
import csv
import math
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib inline
priceData = pd.read_csv('SP_500_close_2015.csv',index_col = 0)
priceData.head()
firms = pd.read_csv("SP_500_firms.csv")
firms.head()
percent_change = priceData.pct_change()
percent_change = percent_chan... | github_jupyter |
# 转置卷积
:label:`sec_transposed_conv`
到目前为止,我们所见到的卷积神经网络层,例如卷积层( :numref:`sec_conv_layer`)和汇聚层( :numref:`sec_pooling`),通常会减少下采样输入图像的空间维度(高和宽)。
然而如果输入和输出图像的空间维度相同,在以像素级分类的语义分割中将会很方便。
例如,输出像素所处的通道维可以保有输入像素在同一位置上的分类结果。
为了实现这一点,尤其是在空间维度被卷积神经网络层缩小后,我们可以使用另一种类型的卷积神经网络层,它可以增加上采样中间层特征图的空间维度。
在本节中,我们将介绍
*转置卷积*(transposed convol... | 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 |
### Strings - Quotation Marks
```
# Quotation marks must be matching. Both of the following work.
good_string = "Hello, how are you?"
another_good_string = 'Hello, how are you?'
# These strings will not work
bad_string = 'Don't do that'
another_bad_string = "Don't do that'
# Notice you enclose the whole sentence in do... | github_jupyter |
# FloPy Creating Layered Quadtree Grids with GRIDGEN
FloPy has a module that can be used to drive the GRIDGEN program. This notebook shows how it works.
The Flopy GRIDGEN module requires that the gridgen executable can be called using subprocess **(i.e., gridgen is in your path)**.
```
import os
import sys
import n... | github_jupyter |
```
run_checks = False
run_sample = False
```
### Overview
This notebook works on the IEEE-CIS Fraud Detection competition. Here I build a simple XGBoost model based on a balanced dataset.
### Lessons:
. keep the categorical variables as single items
. Use a high max_depth for xgboost (maybe 40)
### Ideas to try:... | github_jupyter |
```
# Remember to execute this cell with Shift+Enter
import sys
sys.path.append('../')
import jupman
```
# Tools and scripts
## [Download exercises zip](../_static/generated/tools.zip)
[Browse files online](https://github.com/DavidLeoni/softpython-en/tree/master/tools)
<div class="alert alert-warning">
**REQUISIT... | github_jupyter |
```
import copy
if __name__ == '__main__':
%run Tests.ipynb
%run MoleculeGenerator2.ipynb
%run Discrim.ipynb
%run Rewards.ipynb
%run PPO_WITH_TRICKS.ipynb
%run ChemEnv.ipynb
%run SupervisedPreTraining.ipynb
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
# wants: a... | github_jupyter |
Lambda School Data Science, Unit 2: Predictive Modeling
# Applied Modeling, Module 3
### Objective
- Visualize and interpret partial dependence plots
### Links
- [Kaggle / Dan Becker: Machine Learning Explainability — Partial Dependence Plots](https://www.kaggle.com/dansbecker/partial-plots)
- [Christoph Molnar: Int... | github_jupyter |
# Obtaining movie data, API-testing
```
# open questions:
# API only allows 1k requests per day..
# initial load (static database) or load on request, maybe another API required then?
# regular updates?
import requests
import pandas as pd
```
# get imdb ids
```
# uses links.csv, a list of random imdbIds from https:... | github_jupyter |
# Introduction #
Recall from the example in the previous lesson that Keras will keep a history of the training and validation loss over the epochs that it is training the model. In this lesson, we're going to learn how to interpret these learning curves and how we can use them to guide model development. In particular... | github_jupyter |
# MLP ORF to GenCode
Use GenCode 38 and length-restricted data.
Use model pre-trained on Simulated ORF.
```
import time
def show_time():
t = time.time()
print(time.strftime('%Y-%m-%d %H:%M:%S %Z', time.localtime(t)))
show_time()
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sk... | github_jupyter |
# Step 1: Data gathering
__Step goal__: Download and store the datasets used in this study.
__Step overview__:
1. London demographic data;
2. London shape files;
3. Counts data;
4. Metro stations and lines.
#### Introduction
All data is __open access__ and can be found on the official websites. Note, that the data ... | github_jupyter |
<h1 align="center">Exploratory Analysis : Game of Thrones</h1>

One of the most popular television series of all time, Game of Thrones is a fantasy drama set in fictional continents of Westeros and Essos filled with multi... | github_jupyter |
# Gradient Checking
Welcome to the final assignment for this week! In this assignment you will learn to implement and use gradient checking.
You are part of a team working to make mobile payments available globally, and are asked to build a deep learning model to detect fraud--whenever someone makes a payment, you w... | github_jupyter |
<a href="https://colab.research.google.com/github/mkmritunjay/machineLearning/blob/master/ADABOOSTClassifier.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# ADABOOST (Adaptive Boosting)
```
import pandas as pd
import numpy as np
import seaborn as... | github_jupyter |
# HyperEuler on MNIST-trained Neural ODEs
```
import sys ; sys.path.append('..')
from torchdyn.models import *; from torchdyn import *
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
import pytorch_lightning as pl
from pytorch_lightning.loggers i... | github_jupyter |
# Introduction to Linear Regression
Linear Regression assumes that the relationship between 2 variables, x and y can be modeled by a straight line
$y = \beta_0 + \beta_1x$
We can also see the equation written as : ** y = mx +b**
with $\beta_0$ and $\beta_1$ represents 2 model parameters
$x$ is usually called the *... | github_jupyter |
```
import numpy as np
import tensorflow as tf
import random as rn
import os
import matplotlib.pyplot as plt
%matplotlib inline
os.environ['PYTHONHASHSEED'] = '0'
np.random.seed(1)
rn.seed(1)
from keras import backend as K
tf.compat.v1.set_random_seed(1)
#sess = tf.Session(graph=tf.get_default_graph())
#K.set_session(s... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Modeling" data-toc-modified-id="Modeling-1"><span class="toc-item-num">1 </span>Modeling</a></span><ul class="toc-item"><li><span><a href="#Victims" data-toc-modified-id="Victims-1.1"><span class... | github_jupyter |
```
# evaluate RFE for classification
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import cross_val_score, RepeatedStratifiedKFold, RepeatedKFold
from sklearn.feature_selection import RFE
from sklearn.tree import DecisionTreeClassifier
from sklearn.pipeline import Pip... | github_jupyter |
# [Day 8](https://www.hackerrank.com/challenges/30-dictionaries-and-maps/problem)
```
{'1':'a'}.update({'2':'c'})
d = {}
for i in range(int(input())):
x = input().split()
d[x[0]] = x[1]
while True:
try:
name = input()
if name in d:
print(name, "=", d[name], sep="")
else:... | github_jupyter |
# Illustra: Multi-text to Image
The part of [Aphantasia](https://github.com/eps696/aphantasia) series.
Based on [CLIP](https://github.com/openai/CLIP) + FFT from [Lucent](https://github.com/greentfrapp/lucent) // made by Vadim Epstein [[eps696](https://github.com/eps696)]
thanks to [Ryan Murdock](https://twitter.c... | github_jupyter |
# Introduction to XGBoost Spark with GPU
The goal of this notebook is to show how to train a XGBoost Model with Spark RAPIDS XGBoost library on GPUs. The dataset used with this notebook is derived from Fannie Mae’s Single-Family Loan Performance Data with all rights reserved by Fannie Mae. This processed dataset is re... | github_jupyter |
# Constructing the Set of Equations For the Blocks:
### Newtons second law is applied and each block is considered seperately to form the four equations of motion.
### Newton's Second Law:
$\Sigma F=ma$
#### Note:
In this circumstance, as each mass (except for 4) is on the same angled slope, I have made the decision ... | github_jupyter |
# Building Permit Data
## Documentation
[United States Census Bureau Building Permits Survey](https://www.census.gov/construction/bps/)
[ASCII files by State, Metropolitan Statistical Area (MSA), County or Place](https://www2.census.gov/econ/bps/)
[MSA Folder](https://www2.census.gov/econ/bps/Metro/)
[ASCII MSA Do... | github_jupyter |
# Exp 41 analysis
See `./informercial/Makefile` for experimental
details.
```
import os
import numpy as np
from IPython.display import Image
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import seaborn as sns
sns.set_style('ticks')
matplotlib.r... | github_jupyter |
```
!ln -sf /opt/bin/nvidia-smi /usr/bin/nvidia-smi
!pip install gputil
!pip install psutil
!pip install humanize
import psutil
import humanize
import os
import GPUtil as GPU
GPUs = GPU.getGPUs()
# XXX: only one GPU on Colab and isn’t guaranteed
gpu = GPUs[0]
def printm():
process = psutil.Process(os.getpid())
print(... | github_jupyter |
# Hola mundo...
Agradecemos de manera especial a la PhD Lorena A. Barba [@LorenaABarba](https://twitter.com/LorenaABarba), quien desarrolló el material [CFDPython](https://github.com/barbagroup/CFDPython), sobre el cual está desarrollado el siguiente proyecto pedagógico.
¡Hola! Bienvenido a **Una introducción a la ec... | github_jupyter |
# DOPPELGANGER #
## Ever wondered how your "doppelganger" dog would look like?
# EXPERIMENT LOCALLY
### Prepare Environment
Install and import needed modules.
```
import numpy as np
import pandas as pd
import os
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications.x... | github_jupyter |
## Exercise 3.10 Taxicab (tramcar) problem
Suppose you arrive in a new city and see a taxi numbered 100. How many taxis are there in this city? Let us assume taxis are numbered sequentially as integers starting from 0, up to some unknown upper bound $\theta$. (We number taxis from 0 for simplicity; we can also count fr... | github_jupyter |
<a href="https://colab.research.google.com/github/yahyanh21/Machine-Learning-Homework/blob/main/Week11_Padding_stride_pooling.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!pip install d2l
import torch
from torch import nn
# We define a conv... | github_jupyter |
# Basics & Prereqs (run once)
If you don't already have the downloaded dependencies; if you don't have TheMovieDB data indexed run this
```
from ltr.client.elastic_client import ElasticClient
client = ElasticClient()
from ltr import download, index
from ltr.index import rebuild
from ltr.helpers.movies import indexab... | github_jupyter |
## Nearest Neighbor item based Collaborative Filtering

Source: https://towardsdatascience.com
```
##Dataset url: https://grouplens.org/datasets/movielens/latest/
import pandas as pd
import numpy as np
r_cols = ['user_id','movie_id','rating'... | github_jupyter |
# Data Preprocessing
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.display import display # Allows the use of display() for DataFrames
# Show matplotlib plots inline (nicely formatted in the notebook)
%matplotlib inline
# Load train and test datasets
df_t... | github_jupyter |
# PaddleOCR DJL example
In this tutorial, we will be using pretrained PaddlePaddle model from [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) to do Optical character recognition (OCR) from the given image. There are three models involved in this tutorial:
- Word detection model: used to detect the word block f... | github_jupyter |
<a href="https://colab.research.google.com/github/dhsong95/dacon-emnist-competition/blob/master/notebooks/EMNIST_Notebook.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
from google.colab import drive
drive.mount('/content/gdrive')
%ls /content/... | github_jupyter |
# Física de partículas ... com R e tidyverse
Esse tutorial utiliza os dados abertos do experimento CMS do LHC [CMS Open Data](http://opendata.cern.ch/about/cms) Disponíveis no site [CERN Open Data portal](http://opendata.cern.ch).
Para rodar esse tutorial offline, vide o arquivo [README](https://github.com/cms-open... | github_jupyter |
# Relationships
> A Summary of lecture "Exploratory Data Analysis in Python", via datacamp
- toc: true
- badges: true
- comments: true
- author: Chanseok Kang
- categories: [Python, Datacamp]
- image: images/brfss-boxplot.png
## Exploring relationships
```
import pandas as pd
import numpy as np
import matplotlib.py... | github_jupyter |
```
# Import packages
import os
from matplotlib import pyplot as plt
import pandas as pd
import math
import numpy as np
# Import AuTuMN modules
from autumn.settings import Models, Region
from autumn.settings.folders import OUTPUT_DATA_PATH
from autumn.tools.project import get_project
from autumn.tools import db
from... | github_jupyter |
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-59152712-8"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-59152712-8');
</script>
# ADM Quantities in terms of BSSN Quantities
## Author: Zac... | github_jupyter |
# Part 4: Federated Learning with Model Averaging
**Recap**: In Part 2 of this tutorial, we trained a model using a very simple version of Federated Learning. This required each data owner to trust the model owner to be able to see their gradients.
**Description:**In this tutorial, we'll show how to use the advanced ... | github_jupyter |
##### Copyright 2022 The Cirq Developers
```
# @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 agr... | github_jupyter |
# AutoGluon-Tabular in AWS Marketplace
[AutoGluon](https://github.com/awslabs/autogluon) automates machine learning tasks enabling you to easily achieve strong predictive performance in your applications. With just a few lines of code, you can train and deploy high-accuracy deep learning models on tabular, image, and ... | github_jupyter |
文章来自 作者:子实 更多机器学习笔记访问[这里](https://github.com/zlotus/notes-LSJU-machine-learning)
# 第十五讲:PCA的奇异值分解、独立成分分析
回顾一下上一讲的内容——PCA算法,主要有三个步骤:
1. 将数据正规化为零期望以及单位化方差;
2. 计算协方差矩阵$\displaystyle\varSigma=\frac{1}{m}x^{(i)}\left(x^{(i)}\right)^T$;
3. 找到$\varSigma$的前$k$个特征向量。
在上一讲的最后,我们还介绍了PCA在面部识别中的应用。试想一下,在面部识别中$x^{(i)}\in\mathbb R... | github_jupyter |
<h1 align="center">SimpleITK Spatial Transformations</h1>
**Summary:**
1. Points are represented by vector-like data types: Tuple, Numpy array, List.
2. Matrices are represented by vector-like data types in row major order.
3. Default transformation initialization as the identity transform.
4. Angles specified in ra... | github_jupyter |
In this dataset, were are going to be exploring sales information provided.
```
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load in
import... | github_jupyter |
<!--NAVIGATION-->
< [简单的折线图](04.01-Simple-Line-Plots.ipynb) | [目录](Index.ipynb) | [误差可视化](04.03-Errorbars.ipynb) >
<a href="https://colab.research.google.com/github/wangyingsm/Python-Data-Science-Handbook/blob/master/notebooks/04.02-Simple-Scatter-Plots.ipynb"><img align="left" src="https://colab.research.google.com/a... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sqlalchemy import create_engine
import warnings
warnings.filterwarnings('ignore')
sns.set(style="whitegrid")
postgres_user = 'dsbc_student'
postgres_pw = '7*.8G9QH21'
postgres_host = '142.93.121.174'
postgres_port = '5432'
postgres_db =... | github_jupyter |
```
##### derived from https://github.com/bozhu/AES-Python
import copy
Sbox = (
0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F,... | github_jupyter |
# CME 193 - Lecture 8
Here's what you've seen over the past 7 lectures:
* Python Language Basics
* NumPy - Arrays/Linear Algebra
* SciPy - Sparse Linear Algebra/Optimization
* DataFrames - Reading & Maniputlating tabular data
* Scikit learn - Machine Learning Models & use with data
* Ortools - More Optimization
You'v... | github_jupyter |
```
from utils import *
import gensim
from sklearn.mixture import BayesianGaussianMixture
import json
df = pd.read_csv("assets/finalproduct/finalproductDf")
df.drop(["Unnamed: 0"],axis=1, inplace=True)
id_to_auth = pickle_o.load("assets/dictionaries/id_to_all_auths_2004")
auth_to_id = pickle_o.load("assets/dictionaries... | github_jupyter |
```
import xarray as xr
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seawater as sw
import cartopy.crs as ccrs # import projections
import cartopy.feature as cf # import features
fig_dir='C:/Users/gentemann/Google Drive/f_drive/docs/projects/misst-arct... | github_jupyter |
```
import numpy as np
import pandas as pd
np.random.seed(42)
from sklearn.metrics import mean_squared_error
import time
names = ['user_id', 'movie_id', 'rating', 'timestamp']
df = pd.read_csv('./ml-100k/u.data', sep='\t', names=names)
print(df.head())
print(df.shape)
n_users = df["user_id"].unique().shape[0]
n_movies ... | github_jupyter |
# Processor temperature
We have a temperature sensor in the processor of our company's server. We want to analyze the data provided to determinate whether we should change the cooling system for a better one. It is expensive and as a data analyst we cannot make decisions without a basis.
We provide the temperatures m... | github_jupyter |
# Understanding Data Actions
blocktorch streamlines the creation and implementation of machine learning models for tabular data. One of the many features it offers is [data checks](https://blocktorch.alteryx.com/en/stable/user_guide/data_checks.html), which are geared towards determining the health of the data before ... | github_jupyter |
```
import numpy as np
from bokeh.plotting import figure, show, output_notebook
from bokeh.layouts import gridplot
output_notebook()
N = 9
x = np.linspace(-2, 2, N)
y = x**2
sizes = np.linspace(10, 20, N)
xpts = np.array([-.09, -.12, .0, .12, .09])
ypts = np.array([-.1, .02, .1, .02, -.1])
figures = []
p = figure(title... | 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 |
# LightGBM Test Run
### summary
- 'gender' and 'device' are discrete strings -> dummies (keep both M and F to capture nan info)
- 'drivers', 'vehicles', 'age', 'launch', and 'tenure' are all discrete numeric -> lgbm can handle
- target variable 'outcome' is imbalanced at approximately 1:9 -> use lgbm imbalanced setti... | github_jupyter |
<div class="alert alert-block alert-info">
<font size="5"><b><center> Section 5</font></center>
<br>
<font size="5"><b><center>Recurrent Neural Network in PyTorch with an Introduction to Natural Language Processing</font></center>
</div>
Credit: This example is obtained from the following book:
Subramanian, Vishnu. 2... | github_jupyter |
# Intraday Strategy, Part 2: Model Training & Signal Evaluation
In this notebook, we load the high-quality NASDAQ100 minute-bar trade-and-quote data generously provided by [Algoseek](https://www.algoseek.com/) (available [here](https://www.algoseek.com/ml4t-book-data.html)) and use the features engineered in the last ... | github_jupyter |
```
import numpy as np
import pandas as pd
import holoviews as hv
import networkx as nx
from holoviews import opts
hv.extension('bokeh')
defaults = dict(width=400, height=400)
hv.opts.defaults(
opts.EdgePaths(**defaults), opts.Graph(**defaults), opts.Nodes(**defaults))
```
Visualizing and working with network gr... | github_jupyter |
# Data Analysis of Bitcoin and Where it is Heading
# Graphing the whole Graph
```
#### Importing Pandas and others and Reading csv file
import os
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pandas as pd
import plotly.express as px
##Remodified .CSV data to make managing data easie... | github_jupyter |
<a href="https://colab.research.google.com/github/google/jax-md/blob/main/notebooks/athermal_linear_elasticity.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
#@title Imports and utility code
!pip install jax-md
import numpy as onp
import jax.... | github_jupyter |
## This assignment
In this assignment, you'll learn (or review):
* How to set up Jupyter on your own computer.
* Python basics, like defining functions.
* How to use the `numpy` library to compute with arrays of numbers.
# 2. Python
Python is the main programming language we'll use in this course. We assume you ha... | github_jupyter |
# COVID-19 Analysis across countries and weeks
In this study, the focus is on the country cases. This analysis examines at the case growth, case proportion and weekly growth.
# This kerenel will be updated frequently to keep it up to date
# Library and dataset imports
```
#Importing the libraries
import pandas as ... | github_jupyter |
# 🔪 JAX - The Sharp Bits 🔪
[](https://colab.research.google.com/github/google/jax/blob/master/docs/notebooks/Common_Gotchas_in_JAX.ipynb)
*levskaya@ mattjj@*
When walking about the countryside of [Italy](https://iaml.it/blog/jax-intro), the ... | github_jupyter |
```
# noexport
import os
os.system('export_notebook identify_domain_training_data.ipynb')
from tmilib import *
import csv
import sys
num_prev_enabled = int(sys.argv[1])
num_labels_enabled = 2 + num_prev_enabled
data_version = 4 + num_prev_enabled
print 'num_prev_enabled', num_prev_enabled
print 'data_version', data_ve... | github_jupyter |
```
from matplotlib import pyplot as plt
import pandas as pd
titanic_df = pd.read_csv('train.csv')
titanic_df.head()
titanic_df.columns
male_df = titanic_df[titanic_df['Sex'] == 'male']
female_df = titanic_df[titanic_df['Sex'] == 'female']
male_df.head()
female_df.head()
plt.subplot(1,2,1)
plt.bar([0,1],[sum(male_df['S... | github_jupyter |
# Module 3 Required Coding Activity
Introduction to Python (Unit 2) Fundamentals
All course .ipynb Jupyter Notebooks are available from the project files download topic in Module 1, Section 1.
This is an activity from the Jupyter Notebook **`Practice_MOD03_IntroPy.ipynb`** which you may have already completed.
... | github_jupyter |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/1_getting_started_roadmap/2_elemental_features_of_monk/5)%20Feature%20-%20Switch%20modes%20without%20reloading%20experiment%20-%20train%2C%20eval%2C%20infer.ipynb" target="_parent"><img src="https://colab.research.go... | github_jupyter |
<a href="https://colab.research.google.com/github/towardsai/tutorials/blob/master/random-number-generator/random_number_generator_tutorial.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Random Number Generator Tutorial with Python
* Tutorial: ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.