code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Python 101
```
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
```
### First code in Python
#### Running (executing) a cell
Jupyter Notebooks allow code to be separated into sections that can be executed independent of one another. These sections are call... | github_jupyter |
# Working with Data in OpenCV
Now that we have whetted our appetite for machine learning, it is time to delve a little
deeper into the different parts that make up a typical machine learning system.
Machine learning is all about building mathematical models in order
to understand data. The learning aspect enters this... | github_jupyter |
```
# 显示上传的数据集
!ls /home/aistudio/data/data113944/
!unzip /home/aistudio/data/data113944/steel_bug_detect.zip
# paddle环境准备
!git clone https://gitee.com/paddlepaddle/PaddleDetection.git
%cd PaddleDetection
# 安装其他依赖
! pip install paddledet==2.0.1 -i https://mirror.baidu.com/pypi/simple
! pip install -r requirements.txt
... | github_jupyter |
# Exploring the UTx000 Extension Beiwe Data
(Known as BPEACE2 in the [GH repo](https://github.com/intelligent-environments-lab/utx000))
# Determining if participants were home when completing EMAs
We want to use the GPS data and timestamps of completed EMAs to see if the participant was home when they submitted their ... | github_jupyter |
# **[MC906] Projeto Final**: Detecção de Desastres
O objetivo desse projeto é construir e avaliar modelos de aprendizado de máquina que classifiquem quais Tweets são sobre desastres reais e quais não são.
## **Acessar Diretório do Projeto**
Esse Notebook assume que você está executando o código dentro da pasta `Proj... | github_jupyter |
```
%matplotlib notebook
from pylab import *
from scipy.stats import *
# Population
total_population = 208e6
percentage_0_14 = 0.23
percentage_15_64 = 0.69
percentage_65_ = 0.08
num_adults = total_population*(percentage_15_64 + percentage_65_)
# Labor force
percentage_labor_force = 0.71
labor_force = num_adults*perc... | github_jupyter |
<a href="https://colab.research.google.com/github/alijablack/data-science/blob/main/Wikipedia_NLP_Sentiment_Analysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Natural Language Processing
## Problem Statement
Use natural language processing... | github_jupyter |
# Application
```
import pandas as pd
import numpy as np
property_type = pd.read_csv("final_df.csv")
property_type1 = property_type.iloc[:,1:33]
for i in range(len(property_type1)):
for j in range(2, len(property_type1.columns)):
if type(property_type1.iloc[i,j]) != str:
continue
elif ... | github_jupyter |
## DATA SCIENCE NANO DEGREE
### PROJECT 1: Boston AirBnB
##### MAHBUBUL WASEK
#### Introduction
This is part of the Udacity Data Science Nanodegree (Project 1). In this project we are supposed to analysis data using the CRISP-DM process. The CRISP-DM process:
1) Business Understanding
2) Data Understanding
3) Pr... | github_jupyter |
```
import os
from dotenv import load_dotenv, find_dotenv
from os.path import join, dirname, basename, exists, isdir
### Load environmental variables from the project root directory ###
# find .env automagically by walking up directories until it's found
dotenv_path = find_dotenv()
# load up the entries as environmen... | github_jupyter |
### load library
```
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from tensorflow import keras
# from tensorflow.keras.utils import to_categorical
# from tensorflow.keras.models import Sequential
# from tensorflow.keras.layers import Conv2D, MaxPooling2D, F... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Libraries-&-settings" data-toc-modified-id="Libraries-&-settings-1"><span class="toc-item-num">1 </span>Libraries & settings</a></span></li><li><span><a href="#Metrics" data-toc-modif... | github_jupyter |
# VacationPy
----
#### Note
* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps.
```
# Dependencies and Setup
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import requests
import gmaps
import os
... | github_jupyter |
# Introduction to Modeling Libraries
```
import numpy as np
import pandas as pd
np.random.seed(12345)
import matplotlib.pyplot as plt
plt.rc('figure', figsize=(10, 6))
PREVIOUS_MAX_ROWS = pd.options.display.max_rows
pd.options.display.max_rows = 20
np.set_printoptions(precision=4, suppress=True)
```
## Interfacing Be... | github_jupyter |
# FloPy
### Demo of netCDF and shapefile export capabilities within the flopy export module.
```
import os
import sys
import datetime
# run installed version of flopy or add local path
try:
import flopy
except:
fpth = os.path.abspath(os.path.join('..', '..'))
sys.path.append(fpth)
import flopy
print... | github_jupyter |
```
import torch
# Check if pytorch is using GPU:
print('Used device name: {}'.format(torch.cuda.get_device_name(0)))
```
Import your google drive if necessary.
```
from google.colab import drive
drive.mount('/content/drive')
import sys
import os
ROOT_DIR = 'your_dir'
sys.path.insert(0, ROOT_DIR)
import pickle
import... | github_jupyter |
# NBA Statistics
---
Timothy Helton
This notebook generates figures describing National Basketball Association (NBA) players likelyhood of being a member of the Hall of Fame.
To see the full project please click
[**here**](https://timothyhelton.github.io/nba_stats.html).
---
NOTE: This notebook uses code found in th... | github_jupyter |
# Feature Crosses
Continuing on the previous exercise, we will improve our linear regression model with the addition of more synthetic features.
First, let's define the input and create the data loading code.
```
import math
from IPython import display
from matplotlib import cm
from matplotlib import gridspec
from m... | github_jupyter |
# MODIS Cloud Top Pressure Retrieval
This notebook demsontrates the application of QRNNs to retrieve cloud-top pressure (CTP) from MODIS infrared observations. A similar retrieval will be used in the next version of the EUMETSAT PPS package, for the production
of near-real time (NRT) Meteorological data to support Now... | github_jupyter |
`2017-09-11 Monday`
# Programme sur les 2 ans
Introduction ($\sum\text{termes techniques}$)
1. Microéconomie
2. Macroéconomie
3. Ouverture internationale
4. Économie du développement
# Chapitre 1: Les fondements de l'Economie
## Introduction
L'économie cherche à résoudre les problèmes de satisfaction, des besoins fon... | github_jupyter |
# Notebook version of NSGA-II constrained, without scoop
```
%matplotlib inline
#!/usr/bin/env python
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, ... | github_jupyter |
# Encontrando los Ingredientes de Otros Mundos
Didier Queloz y Michel Mayor encontraron el primer exoplaneta orbitando una estrella similar al Sol, lo que les valió el [premio Nobel de Física 2019](https://www.nobelprize.org/prizes/physics/2019/summary/). Desde entonces, el número de planetas conocidos ha crecido expo... | github_jupyter |
## Let's start!
Manipulating values in any language is done through the use of variables and operations.
### Variables
A variable is a holder for data and allows the programmer to pass around references to the data.
Variables are generally said to be:
* **mutable** - a variable can be changed after creation
* **im... | github_jupyter |
```
from tensorflow import keras
from tensorflow.keras import *
from tensorflow.keras.models import *
from tensorflow.keras.layers import *
from tensorflow.keras.regularizers import l2#正则化L2
import tensorflow as tf
import numpy as np
import pandas as pd
# 12-0.2
# 13-2.4
# 18-12.14
import pandas as pd
import numpy as n... | github_jupyter |
ERROR: type should be string, got "https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/\n# Multivariate Time Series Forecasting with LSTMs in Keras\n\n## Dataset\nThis is a dataset that reports on the weather and the level of pollution each hour for five years at the US embassy in Beijing, China.\n\nBeijing PM2.5 Data Set (rename to raw.csv)\n\nhttps://raw.githubusercontent.com/jbrownlee/Datasets/master/pollution.csv\n\n```\nfrom datetime import datetime\nfrom math import sqrt\n\nfrom numpy import concatenate\n\nfrom pandas import read_csv, DataFrame, concat\n\nfrom sklearn.preprocessing import LabelEncoder, MinMaxScaler\nfrom sklearn.metrics import mean_squared_error\n\nfrom tensorflow.keras.models import Sequential\nfrom tensorflow.keras.layers import Dense, LSTM\n\nfrom matplotlib import pyplot\n# Load data\ndef parse(x):\n return datetime.strptime(x, '%Y %m %d %H')\ndataset = read_csv('raw.csv', parse_dates=[['year', 'month', 'day', 'hour']], index_col=0, date_parser=parse)\ndataset\ndataset.drop('No', axis=1, inplace=True)\n# Manually specify column names\ndataset.columns =['pollution', 'dew', 'temp', 'press', 'wnd_dir', 'wnd_spd', 'snow', 'rain']\ndataset.index.name ='date'\n# Mark all N.A. values with 0\ndataset['pollution'].fillna(0, inplace=True)\n# Drop the first 24 hours\ndataset = dataset[24:]\n# Summarize first 5 rows\nprint(dataset.head(5))\n# Save to file\ndataset.to_csv('pollution.csv')\n```\n\n## Process the new dataset\n\n```\n# Load dataset\ndataset = read_csv('pollution.csv', header=0, index_col=0)\nvalues = dataset.values\n# Specify columns to plot\ngroups = [0, 1, 2, 3, 5, 6, 7]\ni = 1\n# Plot each column\npyplot.figure()\nfor group in groups:\n pyplot.subplot(len(groups), 1, i)\n pyplot.plot(values[:, group])\n pyplot.title(dataset.columns[group], y=0.5, loc='right')\n i += 1\npyplot.show()\n```\n\n## Prepare data for the LSTM\n\n```\n# Convert series to supervised learning\ndef series_to_supervised(data, n_in=1, n_out=1, dropnan=True):\n n_vars = 1 if type(data) is list else data.shape[1]\n df = DataFrame(data)\n cols, names = list(), list()\n\n # Input sequence (t-n, ..., t-1)\n for i in range(n_in, 0, -1):\n cols.append(df.shift(i))\n names += [('var%d(t-%d)' % (j+1, i)) for j in range(n_vars)]\n\n # Forecast sequence\n for i in range(0, n_out):\n cols.append(df.shift(-i))\n if i == 0:\n names += [('var%d(t)' % (j+1)) for j in range(n_vars)]\n else:\n names += [('var%d(t+%d)' % (j+1, i)) for j in range(n_vars)]\n \n # Put it all together\n agg = concat(cols, axis=1)\n agg.columns = names\n \n # Drop rows with NaN values\n if dropnan:\n agg.dropna(inplace=True)\n \n return agg\n# Load dataset\ndataset = read_csv('pollution.csv', header=0, index_col=0)\nvalues = dataset.values\n# Integer encode direction\nencoder = LabelEncoder()\nvalues[:, 4] = encoder.fit_transform(values[:, 4])\n# Ensure all data is float\nvalues = values.astype('float32')\n# Normalize features\nscaler = MinMaxScaler(feature_range=(0, 1))\nscaled = scaler.fit_transform(values)\n# Specify number of lag hours\nn_hours = 3\nn_features = 8\n# Frame as supervised learning\nreframed = series_to_supervised(scaled, n_hours, 1)\nreframed.shape\n```\n\n## Define and fit the model\n\n```\n# Split into train and test sets\nvalues = reframed.values\nn_train_hours = 365 * 24\ntrain = values[:n_train_hours, :]\ntest = values[n_train_hours:, :]\n# Split into input and outputs\nn_obs = n_hours * n_features\ntrain_X, train_y = train[:, :n_obs], train[:, -n_features]\ntest_X, test_y = test[:, :n_obs], test[:, -n_features]\n# Reshape input to be 3D [samples, timesteps, features]\ntrain_X = train_X.reshape((train_X.shape[0], n_hours, n_features))\ntest_X = test_X.reshape((test_X.shape[0], n_hours, n_features))\ntrain_X.shape, train_y.shape, test_X.shape, test_y.shape\n# Design network\nmodel = Sequential()\nmodel.add(LSTM(50, input_shape=(train_X.shape[1], train_X.shape[2])))\nmodel.add(Dense(1))\nmodel.compile(loss='mae', optimizer='adam')\n# Fit network\nhistory = model.fit(train_X, train_y, \n epochs=50, batch_size=72, \n validation_data=(test_X, test_y), \n verbose=2, shuffle=False)\n# Plot history\npyplot.plot(history.history['loss'], label='train')\npyplot.plot(history.history['val_loss'], label='test')\npyplot.legend()\npyplot.show()\n```\n\n## Evaluate model\n\n```\n# Make a prediction\nyhat = model.predict(test_X)\ntest_X = test_X.reshape((test_X.shape[0], n_hours*n_features))\n# Invert scaling for forecast\ninv_yhat = concatenate((yhat, test_X[:, -7:]), axis=1)\ninv_yhat = scaler.inverse_transform(inv_yhat)\ninv_yhat = inv_yhat[:, 0]\n# Invert scaling for actual\ntest_y = test_y.reshape(len(test_y), 1)\ninv_y = concatenate((test_y, test_X[:, -7:]), axis=1)\ninv_y = scaler.inverse_transform(inv_y)\ninv_y = inv_y[:, 0]\n# Calculate RMSE\nrmse = sqrt(mean_squared_error(inv_y, inv_yhat))\nrmse\n```\n\n" | github_jupyter |
```
%matplotlib inline
```
# Constructing multiple views to classify singleview data
As demonstrated in "Asymmetric bagging and random subspace for support vector
machines-based relevance feedback in image retrieval" (Dacheng 2006), in high
dimensional data it can be useful to subsample the features and construct
mu... | github_jupyter |
```
# Dependencies
import numpy as np
import pandas as pd
import datetime as dt
%matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
# Python SQL toolkit and Object Relational Mapper
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalche... | github_jupyter |
# RPA com Python
- O que é RPA?
- Por que isso é diferente de Selenium/Web-Scraping e do que vimos até agora?
- Pontos Positivos
- Pontos Negativos
- Biblioteca usada:
- pip install pyautogui
- https://pyautogui.readthedocs.io/en/latest/
- Para os comandos de imagem pode ser que seja necessário... | github_jupyter |
# 08 Errors
(See also *Computational Physics* (Landau, Páez, Bordeianu), Chapter 3)
These slides include material from *Computational Physics. eTextBook Python 3rd Edition.* Copyright © 2012 Landau, Rubin, Páez. Used under the Creative-Commons Attribution-NonCommerical-ShareAlike 3.0 Unported License.
## Stupidity ... | github_jupyter |
# Homework assignment #3
These problem sets focus on using the Beautiful Soup library to scrape web pages.
## Problem Set #1: Basic scraping
I've made a web page for you to scrape. It's available [here](http://static.decontextualize.com/widgets2016.html). The page concerns the catalog of a famous [widget](http://en.... | github_jupyter |

# 1. Introduction
This notebook demonstrates how to create two parallel video pipelines using the GStreamer multimedia framework:
* The first pipeline captures video from a V4L2 device and displays the output on a monitor using a DRM/KMS display device.
* The secon... | github_jupyter |
# Running a Federated Cycle with Synergos
In a federated learning system, there are many contributory participants, known as Worker nodes, which receive a global model to train on, with their own local dataset. The dataset does not leave the individual Worker nodes at any point, and remains private to the node.
The j... | github_jupyter |
## 人脸过滤器
现在,使用已训练的人脸关键点检测器,就可以自动执行一些操作了,比如将过滤器添加到人脸。这个notebook是可选的,你可以根据在人眼周围检测到的关键点为图像中检测到的人脸添加太阳镜。打开`images/`目录,看一看我们还为你提供了哪些用于尝试的 .png!
<img src="images/face_filter_ex.png" width=60% height=60%/>
下面,查看一下我们将要使用的太阳镜.png,然后开始行动吧!
```
# import necessary resources
import matplotlib.image as mpimg
import matplotlib.py... | github_jupyter |
```
import torch
import torch.nn as nn
import numpy as np
from copy import deepcopy
device = "cuda" if torch.cuda.is_available() else "cpu"
class RBF(nn.Module):
def __init__(self):
super(RBF, self).__init__()
torch.cuda.manual_seed(0)
self.rbf_clt = self.init_clt()
self.rb... | github_jupyter |
# Aufgaben Blatt1
# Aufgabe 1
```
year = 1998:2017
snowcover = c(25.0, 23.9, 25.1, 24.4, 21.2, 26.1, 23.2, 25.5, 24.9, 24.0, 21.3, 23.8, 26.1, 26.0, 26.1, 25.1, 22.2, 23.4, 22.6, 24.6)
snow = data.frame(years=year, covers=snowcover)
plot(snowcover~year, snow)
plot(snowcover~year, snow, type="l")
abline(lm(snowcover~ye... | github_jupyter |
```
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')
```
**confusion matrix**
```
sns.set(font_scale=2)
# 행은 실제값, 열은 예측값
array = [[5,0,0,0], # A인데 A로 예측한 것이 5건
[0,10,0,0], # B인데 B로 예측한 것이 10건
[0,0,15,0],
[0,0,0,... | github_jupyter |
```
import os
import numpy as np
import sys
import matplotlib.pyplot as plt
from matplotlib import rc
from matplotlib.pyplot import cm
from library.trajectory import Trajectory
# uzh trajectory toolbox
sys.path.append(os.path.abspath('library/rpg_trajectory_evaluation/src/rpg_trajectory_evaluation'))
import plot_utils ... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Goal" data-toc-modified-id="Goal-1"><span class="toc-item-num">1 </span>Goal</a></span></li><li><span><a href="#Var" data-toc-modified-id="Var-2"><span class="toc-item-num">2 </span>Va... | github_jupyter |
# Distributed Object Tracker RL training with Amazon SageMaker RL and RoboMaker
---
## Introduction
In this notebook, we show you how you can apply reinforcement learning to train a Robot (named Waffle) track and follow another Robot (named Burger) by using the [Clipped PPO](https://coach.nervanasys.com/algorithms/p... | github_jupyter |
# Benchmark and Repositories
```
%matplotlib inline
from matplotlib import pyplot as plt
import networkx as nx
import matplotlib.pyplot as plt
import pandas as pd
default_edge_color = 'gray'
default_node_color = '#407cc9'
enhanced_node_color = '#f5b042'
enhanced_edge_color = '#cc2f04'
output_dir = "./"
import os
def ... | github_jupyter |
# This jupyter notebook contains examples of
- some basic functions related to Global Distance Test (GDT) analyses
- local accuracy plot
```
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import MDAnalysis as mda
import pyrexMD.misc as misc
import pyrexMD.core as core
import pyrexMD.topology ... | github_jupyter |
# Text Using Markdown
**If you double click on this cell**, you will see the text change so that all of the formatting is removed. This allows you to edit this block of text. This block of text is written using [Markdown](http://daringfireball.net/projects/markdown/syntax), which is a way to format text using headers,... | github_jupyter |
# Amazon product data mapping
```
# importing libraries
from fuzzywuzzy import fuzz
import pandas as pd
import re
import csv
import warnings
warnings.filterwarnings('ignore')
# Amazon product dataset
amazon = pd.read_csv('AmazonProductdata.csv')
# change columns name
amazon.rename(columns={'Name': 'Amazon_Name',
... | github_jupyter |
# 数据管理
本节内容可应用在数据读取之后。包括基本的运算(包括统计函数)、数据重整(排序、合并、子集、随机抽样、整合、重塑等)、字符串处理、异常值(NA/Inf/NaN)处理等内容。也包括 apply() 这种函数式编程函数的使用。
## 数学函数
数学运算符和一些统计学上需要的函数。
### 数学运算符
| 四则 | 幂运算 | 求余 | 整除 |
| --- | --- | --- | --- |
| +, -, \*, / | ^ 或 \*\* | %% | %/% |
例子:
```
a <- 2 ^ 3
b <- 5 %% 2
c <- 5 %/% 2
print(c(a, b, c))
```
### ... | github_jupyter |
<h3> ABSTRACT </h3>
All CMEMS in situ data products can be found and downloaded after [registration](http://marine.copernicus.eu/services-portfolio/register-now/) via [CMEMS catalogue] (http://marine.copernicus.eu/services-portfolio/access-to-products/).
Such channel is advisable just for sporadic netCDF donwloading ... | 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>
# Tutorial-IllinoisGRMHD: ID_converter_ILGRMHD ETKThorn
##... | github_jupyter |
```
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style("whitegrid", {"font.family": "DejaVu Sans"})
sns.set(palette="pastel", color_codes=True)
sns.set_context("poster")
%matplotlib inline
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=Tru... | github_jupyter |
### Bibliotecas Utilizadas:
```
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
```
- Faça um ranking para o número total de PAX por dia da semana. - - Power BI
- Qual a correlação de sábado e domingo somados com o total de RPK? - ????
- Qual a média de ‘Monetário’ por ... | github_jupyter |
# TensorFlow script mode training and serving
Script mode is a training script format for TensorFlow that lets you execute any TensorFlow training script in SageMaker with minimal modification. The [SageMaker Python SDK](https://github.com/aws/sagemaker-python-sdk) handles transferring your script to a SageMaker train... | github_jupyter |
# Rekurrente Netze (RNNs)
## Sequentialle Daten
<img src="img/ag/Figure-22-001.png" style="width: 10%; margin-left: auto; margin-right: auto;"/>
## Floating Window
<img src="img/ag/Figure-22-002.png" style="width: 20%; margin-left: auto; margin-right: auto;"/>
## Verarbeitung mit MLP
<img src="img/ag/Figure-22-00... | github_jupyter |
# This notebook is copied from [here](https://github.com/warmspringwinds/tensorflow_notes/blob/master/tfrecords_guide.ipynb) with some small changes
---
### Introduction
In this post we will cover how to convert a dataset into _.tfrecord_ file.
Binary files are sometimes easier to use, because you don't have to spec... | github_jupyter |
# Transfer Learning Template
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
import os, json, sys, time, random
import numpy as np
import torch
from torch.optim import Adam
from easydict import EasyDict
import matplotlib.pyplot as plt
from steves_models.steves_ptn import Steves_Prototypical_Network
... | github_jupyter |
# Custom Models in pycalphad: Viscosity
## Viscosity Model Background
We are going to take a CALPHAD-based property model from the literature and use it to predict the viscosity of Al-Cu-Zr liquids.
For a binary alloy liquid under small undercooling, Gąsior suggested an entropy model of the form
$$\eta = (\sum_i x_i... | github_jupyter |
# Section 3.3
```
%run preamble.py
danish = pd.read_csv("../Data/danish.csv").x.values
```
# MLE of composite models
```
parms, BIC, AIC = mle_composite(danish, (1,1,1), "gam-par")
fit_gam_par = pd.DataFrame(np.append(parms, [AIC, BIC])).T
fit_gam_par.columns = ["shape", "tail", "thres", "AIC","BIC"]
print(fit_gam_p... | github_jupyter |
# "[Prob] Basics of the Poisson Distribution"
> "Some useful facts about the Poisson distribution"
- toc:false
- branch: master
- badges: false
- comments: true
- author: Peiyi Hung
- categories: [category, learning, probability]
# Introduction
The Poisson distribution is an important discrete probability distributi... | github_jupyter |
<table> <tr>
<td style="background-color:#ffffff;">
<a href="http://qworld.lu.lv" target="_blank"><img src="..\images\qworld.jpg" width="25%" align="left"> </a></td>
<td style="background-color:#ffffff;vertical-align:bottom;text-align:right;">
prepared by <a href="http://abu.lu.... | github_jupyter |
# Transcript to BUILD wavs
```
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
%load_ext autoreload
%autoreload 2
%matplotlib inline
from glob import glob
import os
from matplotlib.pylab import *
import librosa
import torch
from epoch_time import epo... | github_jupyter |
# Introduction
```
#r "BoSSSpad.dll"
using System;
using System.Collections.Generic;
using System.Linq;
using ilPSP;
using ilPSP.Utils;
using BoSSS.Platform;
using BoSSS.Platform.LinAlg;
using BoSSS.Foundation;
using BoSSS.Foundation.XDG;
using BoSSS.Foundation.Grid;
using BoSSS.Foundation.Grid.Classic;
... | github_jupyter |
# ***Introduction to Radar Using Python and MATLAB***
## Andy Harrison - Copyright (C) 2019 Artech House
<br/>
# Alpha Beta Filter
***
Referring to Section 9.1.1, the alpha-beta filter, is a simplified filter for parameter estimation and smoothing. The alpha-beta filter is related to Kalman filters but does not requ... | github_jupyter |
# Pre-computing various second-moment related quantities
This saves computation for M&M by precomputing and re-using quantitaties shared between iterations. It mostly saves $O(R^3)$ computations. This vignette shows results agree with the original version. Cannot use unit test due to numerical discrepency between `cho... | github_jupyter |
```
import sys
sys.path.append('/opt/cocoapi/PythonAPI')
from pycocotools.coco import COCO
from data_loader import get_loader
from torchvision import transforms
# TODO #1: Define a transform to pre-process the testing images.
transform_test = transforms.Compose([
transforms.Resize(256), #... | github_jupyter |
From https://pythonprogramming.net/testing-visualization-and-conclusion/?completed=/basic-image-recognition-testing/
```
!apt-get install -y unzip
!wget https://pythonprogramming.net/static/downloads/image-recognition/tutorialimages.zip
!unzip tutorialimages.zip
!cp images/numbers/3.8.png images/test.png
%matplotlib i... | github_jupyter |
```
# Convolutional Variational Autoencoder taken from TensorFlow Tutorials
# https://www.tensorflow.org/tutorials/generative/cvae
# preferably run with a GPU or on Google Colab etc
# to generate gifs
!pip install -q imageio
import tensorflow as tf
import os
import time
import numpy as np
import glob
import matplotli... | github_jupyter |
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS109B Data Science 2: Advanced Topics in Data Science
## Lab 2 - Smoothers and Generalized Additive Models
**Harvard University**<br>
**Spring 2019**<br>
**In... | github_jupyter |
# 列表List
- 一个列表可以储存任意大小的数据集合,你可以理解为他是一个容器
```
def b():
pass#列表储存数据
a=[1,2,1,5,'ab',True,b]
a
c='zxc'
list(c)
"".join(['a','b'])
```
## 先来一个例子爽一爽

## 创建一个列表
- a = [1,2,3,4,5]
## 列表的一般操作

```
s='aaa'
s*8
a=100
b=[1,2,34,5]
a in b
a=[100]
b=[1,2,3,4,a]
a in b
a=[1,2]
b=[3... | github_jupyter |
<br>
<h1 style = "font-size:30px; font-weight : bold; color : black; text-align: center; border-radius: 10px 15px;"> Telco Customer Churn: EDA, Predictions and Feature Importance with SHAP </h1>
<br>
# Goals
Perform an Exploratory Data Analysis (EDA) to visualize and understand:
* The distribution of values of the tar... | github_jupyter |
### **Install ChEMBL client for getting the dataset**
#### **https://www.ebi.ac.uk/chembl/**
```
!pip install chembl_webresource_client
```
### **Import Libraries**
```
import pandas as pd
from chembl_webresource_client.new_client import new_client
```
### **Find Coronavirus Dataset**
#### **Search Target**
```
... | github_jupyter |
```
%matplotlib inline
import sys, os
sys.path.append("../")
import numpy as np
import scipy as sp
import numpy.linalg as nla
import matplotlib as mpl
import matplotlib.pyplot as plt
from timeit import timeit
import ot
import ot.plot
from ot.datasets import make_1D_gauss as gauss
from drot.solver import drot, sinkhorn
... | github_jupyter |
```
import itertools
import numpy as np
import pandas as pd
from scipy import stats
from ebnmpy.estimators import estimators
def sample_point_normal(n, pi0=.9, mu=0, sigma=2):
not_delta = stats.bernoulli.rvs(pi0, size=n) == 0
z = np.full(n, mu, dtype=float)
z[not_delta] = stats.norm.rvs(mu, sigma, size=no... | github_jupyter |
# Facial Keypoint Detection
This project will be all about defining and training a convolutional neural network to perform facial keypoint detection, and using computer vision techniques to transform images of faces. The first step in any challenge like this will be to load and visualize the data you'll be working ... | github_jupyter |
```
import os
import sys
module_path = os.path.abspath(os.path.join('../src'))
if module_path not in sys.path:
sys.path.append(module_path)
from prefix_span import PrefixSpan
from js_distance import JS
from sequence_generator import SequenceGenerator
```
# Descriptive Database
The tabel `data` contains the f... | github_jupyter |
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS109B Data Science 2: Advanced Topics in Data Science
## Lab 4 - Bayesian Analysis
**Harvard University**<br>
**Spring 2020**<br>
**Instructors:** Mark Glickm... | github_jupyter |
# Introduction to Machine Learning
## What is Machine Learning?
Machine Learning is the field of study that gives computers the capability to learn without being explicitly programmed.
I like to think of it as a comparison rather than a definition.
- If you **can** give clear instructions on how to do the task - tr... | github_jupyter |
```
from cubelib.stac_eco import Stac_eco
from cubelib.fm_map import Fmap
import pandas as pd
# pd.set_option('display.max_colwidth', None)
# pd.set_option('display.max_rows', None)
# pd.set_option('display.max_columns', None)
# pd.set_option('display.width', 2000)
#! cp ../2_Gridding_For_Scale/*.geojson .
! ls *.geojs... | github_jupyter |
```
import warnings
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from astropy.io import fits
from astropy.table import Table
import pandas as pd
import numpy as np
np.seterr(divide='ignore')
warnings.filterwarnings("ignore", category=RuntimeWarning)
class HRCevt... | github_jupyter |
# Parameterizing with Continuous Variables
```
from IPython.display import Image
```
## Continuous Factors
1. Base Class for Continuous Factors
2. Joint Gaussian Distributions
3. Canonical Factors
4. Linear Gaussian CPD
In many situations, some variables are best modeled as taking values in some continuous space. 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 |
<center>
<img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/Logos/organization_logo/organization_logo.png" width="300" alt="cognitiveclass.ai logo" />
</center>
# K-Nearest Neighbors
Estimated time needed: **25** minutes
## Objectives
After completing this lab you will b... | github_jupyter |
```
# 使下面的代码支持python2和python3
from __future__ import division, print_function, unicode_literals
# 查看python的版本是否为3.5及以上
import sys
assert sys.version_info >= (3, 5)
# 查看sklearn的版本是否为0.20及以上
import sklearn
assert sklearn.__version__ >= "0.20"
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
... | github_jupyter |
```
# notebook that produces all plots for UBE3A_HUN_paper
import matplotlib.pyplot as plt
import config
% matplotlib inline
modes = ['UBE3A','CAMK2D']
# UBE3A and CAMK2D network
# plot the distribution of the fraction of seeds retained in the randomly built networks
# and compare to the fraction of seeds in the rea... | github_jupyter |
```
import pandas as pd
from datetime import datetime, timedelta
import time
import requests
import numpy as np
import json
import urllib
from pandas.io.json import json_normalize
import re
import os.path
import zipfile
from glob import glob
url ="https://api.usaspending.gov/api/v1/awards/?limit=100"
r = requests.get(u... | github_jupyter |
# Understanding Classification and Logistic Regression with Python
## Introduction
This notebook contains a short introduction to the basic principles of classification and logistic regression. A simple Python simulation is used to illustrate these principles. Specifically, the following steps are performed:
- A dat... | github_jupyter |
# Implementation of Softmax Regression from Scratch
:label:`chapter_softmax_scratch`
Just as we implemented linear regression from scratch,
we believe that multiclass logistic (softmax) regression
is similarly fundamental and you ought to know
the gory details of how to implement it from scratch.
As with linear regr... | github_jupyter |
# Optimization Methods
Until now, you've always used Gradient Descent to update the parameters and minimize the cost. In this notebook, you will learn more advanced optimization methods that can speed up learning and perhaps even get you to a better final value for the cost function. Having a good optimization algorit... | github_jupyter |
# PTSD Model Inference with IRT Features
## [Center for Health Statistics](http://www.healthstats.org)
## [The Zero Knowledge Discovery Lab](http://zed.uchicago.edu)
---
```
import numpy as np
import matplotlib.pyplot as plt
from sklearn import svm
import pandas as pd
import seaborn as sns
from sklearn import svm
f... | github_jupyter |
```
# To begin, I created a folder called "Project3_dataTest". I placed the fer2013.csv
# file within the Project3_data folder, and then I ran the following code.
import numpy as np
import pandas as pd
import os
from PIL import Image
df = pd.read_csv('/Users/blakemyers/Desktop/Jupyter/Project3_dataTest/fer2013.csv')
df... | github_jupyter |
<table align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/ShopRunner/collie/blob/main/tutorials/05_hybrid_model.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" /> Run in Google Colab</a>
</td>
<td>
<a target="_blank" href="https://github.com/ShopRu... | github_jupyter |
# Ensemble Clustering for Graphs (ECG)
# Does not run on Pascal
In this notebook, we will use cuGraph to identify the cluster in a test graph using the Ensemble Clustering for Graph approach.
Notebook Credits
* Original Authors: Bradley Rees and James Wyles
* Created: 04/24/2020
* Last Edit: 08/16/2020
RAPIDS Ve... | github_jupyter |
This script goes along my blog post:
Keras Cats Dogs Tutorial (https://jkjung-avt.github.io/keras-tutorial/)
"""
from tensorflow.python.keras import backend as K
from tensorflow.python.keras.models import Model
from tensorflow.python.keras.layers import Flatten, Dense, Dropout
from tensorflow.python.keras.application... | github_jupyter |
# Implicit Georeferencing
This workbook sets explicit georeferences from implicit georeferencing through names of extents given in dataset titles or keywords.
A file `sources.py` needs to contain the CKAN and SOURCE config as follows:
```
CKAN = {
"dpaw-internal":{
"url": "http://internal-data.dpaw.wa.gov.au/"... | github_jupyter |
```
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [12.0, 6.0]
import okama as ok
```
**EfficientFrontier** class can be used for "classic" frontiers where all portfolios are **rebalanced mothly**. It's the most easy and fast way to draw an Efficient Frontier.
### Simple efficient frontier for 2 ET... | github_jupyter |
<a href="https://colab.research.google.com/github/xavoliva6/dpfl_pytorch/blob/main/experiments/exp_FedMNIST.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
#Experiments on FedMNIST
**Colab Support**<br/>
Only run the following lines if you want to ... | github_jupyter |
```
# for reading and validating data
import emeval.input.spec_details as eisd
import emeval.input.phone_view as eipv
import emeval.input.eval_view as eiev
# Visualization helpers
import emeval.viz.phone_view as ezpv
import emeval.viz.eval_view as ezev
import emeval.viz.geojson as ezgj
import pandas as pd
# Metrics hel... | github_jupyter |
```
import pandas as pd
from urllib.request import urlopen
import requests
from bs4 import BeautifulSoup
from graphviz import Digraph
import re
import time
import numpy as np
an_urllib = urlopen("https://animalcrossing.fandom.com/wiki/Villager_list_(New_Horizons)")
an_request = requests.get("https://animalcrossing.fand... | github_jupyter |
```
import wandb
import nltk
from nltk.stem.porter import *
from torch.nn import *
from torch.optim import *
import numpy as np
import pandas as pd
import torch,torchvision
import random
from tqdm import *
from torch.utils.data import Dataset,DataLoader
stemmer = PorterStemmer()
PROJECT_NAME = 'Amazon-Alexa-Reviews'
de... | github_jupyter |
<img width="100" src="https://carbonplan-assets.s3.amazonaws.com/monogram/dark-small.png" style="margin-left:0px;margin-top:20px"/>
# Forest Emissions Tracking - Validation
_CarbonPlan ClimateTrace Team_
This notebook compares our estimates of country-level forest emissions to prior estimates from other
groups. The ... | github_jupyter |
# Interpolation
**Learning Objective:** Learn to interpolate 1d and 2d datasets of structured and unstructured points using SciPy.
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
```
## Overview
We have already seen how to evaluate a Python function at a set of numeri... | github_jupyter |
*Call expressions* invoke [functions](functions), which are named operations.
The name of the function appears first, followed by expressions in
parentheses.
For example, `abs` is a function that returns the absolute value of the input
argument:
```
abs(-12)
```
`round` is a function that returns the input argument ... | github_jupyter |
_Lambda School Data Science — Model Validation_
# Validate classification problems
Objectives
- Imbalanced Classes
- Confusion Matrix
- ROC AUC
Reading
- [Simple guide to confusion matrix terminology](https://www.dataschool.io/simple-guide-to-confusion-matrix-terminology/)
- [Precision and Recall](https://en.wikipe... | github_jupyter |
## Don't worry if you don't understand everything at first! You're not supposed to. We will start using some "black boxes" and then we'll dig into the lower level details later.
## To start, focus on what things DO, not what they ARE.
# What is NLP?
Natural Language Processing is technique where computers tr... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.