text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# 7. Input and Ouput
## 7.1. Fancier Output Formatting
```
year = 2016
event = 'Referendum'
f'Results of the {year} {event}'
yes_votes = 42_572_654
no_votes = 43_132_495
percentage = yes_votes / (yes_votes+no_votes)
'{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)
s = 'Hello, world.'
str(s)
repr(s)
str(1/7)
x =... | github_jupyter |
# Autoencoders
[Source](https://twitter.com/rickwierenga/status/1216801014004797446)
```
%tensorflow_version 2.x
%pylab inline
import tensorflow as tf
(x_train, _), (x_test, _) = tf.keras.datasets.mnist.load_data()
x_train = x_train / 255
x_test = x_test / 255
```
# Simple auto encoder
```
encoder = tf.keras.models... | github_jupyter |
credit: https://github.com/airsplay/py-bottom-up-attention
```
%%capture
!git clone https://github.com/airsplay/py-bottom-up-attention.git
%cd py-bottom-up-attention
# Install python libraries
!pip install -r requirements.txt
!pip install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI'
# Inst... | github_jupyter |
This is a tensorflow version of Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks
based on a mixed numpy/tensorflow version (The PNet, RNet, ONet weights are imported from this) the post processing has been put into the tf graph to allow it to be exported as a large pb graph which can ... | github_jupyter |
# <u>Chapter 3</u>: Topic Classification
Businesses deal with many other unstructured texts daily, like, news posts, support tickets, or customer reviews. Failing to glean this data efficiently can lead to missed opportunities or, even worse, angry customers. So again, an automated system that can process a vast amoun... | github_jupyter |
[](https://colab.research.google.com/github/MisaOgura/flashtorch/blob/master/examples/activation_maximization_colab.ipynb)
## Activation maximization
---
A quick demo of activation maximization with [FlashTorch 🔦](https://github.com/MisaOgura... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content-dl/blob/main/projects/ComputerVision/transfer_learning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Transfer Learning
**By Neuromatch Academy**
__Content crea... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
*This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pyth... | github_jupyter |
# Gaussian processes
A common applied statistics task involves building regression models to characterize non-linear relationships between variables. It is possible to fit such models by assuming a particular non-linear functional form, such as a sinusoidal, exponential, or polynomial function, to describe one variabl... | github_jupyter |
### There are two types of supervised machine learning algorithms: Regression and classification. The former predicts continuous value outputs while the latter predicts discrete outputs. For instance, predicting the price of a house in dollars is a regression problem whereas predicting whether a tumor is malignant or b... | github_jupyter |
# Explicit 5D Benchmarks
This file demonstrates how to generate, plot, and output data for 1d benchmarks
Choose from:
1. Korns_01
1. Korns_02
1. Korns_03
1. Korns_04
1. Korns_05
1. Korns_06
1. Korns_07
1. Korns_08
1. Korns_09
1. Korns_10
1. Korns_11
1. Korns_12
1. Korns_13
1. Korns_14
1. Korns_15
### Imports
```
... | github_jupyter |
## Rotate, zoom, transform, change contrast to get new data
```
import os
import PIL
import cv2
import pathlib
import numpy as np
import pandas as pd
import seaborn as sn
import tensorflow as tf
from tensorflow import keras
from matplotlib import pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from sklear... | github_jupyter |
```
import numpy as np
from tqdm import tqdm
import os
import h5py
import sklearn.metrics as metrics
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch.nn.parallel
from torch.utils.data import Dataset, DataLoader
import torch.nn.init as init
import random
class ... | github_jupyter |
1-1 인공지능과 가위바위보 하기
```
#손글씨 분류기 활용.
#데이터 준비->딥러닝 네트워크 설계->학습->테스트(평가)
```
1-2 데이터를 준비하자!
MNIST 숫자 손글씨 Dataset 불러들이기
```
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
print(tf.__version__) # Tensorflow의 버전을 출력
mnist = keras.datasets.mnist
# MNIST 데이터를 로드. 다운로... | github_jupyter |
**Getting Started**
This tutorial relies on standard python packages as well as [SimPEG](http://simpeg.xyz). If you do not have SimPEG installed, you can uncomment the next line and install it from [pypi](https://pypi.python.org/pypi/SimPEG).
```
# !pip install SimPEG
import numpy as np
import scipy.sparse as sp
from... | github_jupyter |
```
#IMPORT SEMUA LIBARARY
#IMPORT LIBRARY PANDAS
import pandas as pd
#IMPORT LIBRARY UNTUK POSTGRE
from sqlalchemy import create_engine
import psycopg2
#IMPORT LIBRARY CHART
from matplotlib import pyplot as plt
from matplotlib import style
#IMPORT LIBRARY BASE PATH
import os
import io
#IMPORT LIBARARY PDF
from fpdf im... | github_jupyter |
```
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
import pandas
df = pandas.read_excel("resources/Goddess/goddess of everything else essays.xlsx")
def get_end_row_num():
for row_num in range(df.shape[0]):
if df.iloc[row_num,0] == 'END'... | github_jupyter |
# Solutions for chapter 10 exercises
## Setup
```
# Common libraries
import pandas as pd
import numpy as np
import statsmodels.formula.api as smf
from statsmodels.formula.api import ols
import seaborn as sns
# To rescale numeric variables
from sklearn.preprocessing import MinMaxScaler
# To one-hot encode cat. variab... | github_jupyter |
# Pytsal Anomaly Detection Tutorial
**Created using: Pytsal 1.1.0**
**Date Updated: May 08, 2021**
**Tutorial Author: Krishnan S G**
## 1.0 Tutorial Objective
Welcome to Anomaly detection Tutorial. This tutorial assumes that you are new to Pytsal and looking to get started with Anomaly detection using the `pytsal.... | github_jupyter |
# Latent Dirichlet Allocation
- Paper: Latent Dirichlet Allocatio
- Author: David M.Blei, Andrew Y.Ng, Michael I.Jordan
- Teammates: Yizi Lin, Siqi Fu
- Github: https://github.com/lyz1206/lda.git
### Part 1 Abstract
*Latent Dirichlet Allocation* (LDA) is a generative probabilitistic model dealing with collections of... | github_jupyter |
```
# Copyright 2021 Google LLC
#
# 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 agreed to in writi... | github_jupyter |
# Exploration of Quora dataset
```
import sys
sys.path.append("..")
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use("dark_background") # comment out if using light Jupyter theme
dtypes = {"qid": str, "question_text": str, "target": int}
train = pd.read_csv("... | github_jupyter |
Someone asked how to generate outputs to use with [LibFFM](https://github.com/guestwalk/libffm)
So all I do is to use pandas cuts for the numerics to turn them into categories. Feel free to try using them as straight numerics if you wish. I have tried to make it as generic as possible so you can use it on other com... | github_jupyter |
# Normalizing Flows Overview
Normalizing Flows is a rich family of distributions. They were described by [Rezende and Mohamed](https://arxiv.org/abs/1505.05770), and their experiments proved the importance of studying them further. Some extensions like that of [Tomczak and Welling](https://arxiv.org/abs/1611.09630) ma... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.spatial.distance as dist
import collections
import time
import warnings
warnings.filterwarnings('ignore')
from sklearn.cluster import KMeans
from numba import jit, vectorize, float64, int64
@jit
def jit_kmeans_pp(data, k, weigh... | github_jupyter |
# 2D Advection-Diffusion equation
in this notebook we provide a simple example of the DeepMoD algorithm and apply it on the 2D advection-diffusion equation.
```
import numpy as np
import pandas as pd
from scipy.io import loadmat
from deepymod.DeepMoD import DeepMoD
from deepymod.library_functions import library_2Di... | github_jupyter |
## Read Data
```
import pandas as pd
from pathlib import Path
import pickle
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder
import bisect
import numpy as np
input_filepath = '../data/interim/'
output_filepath = '../data/processed/'
# cols
BINARY_COLS = Path.cwd().joinpa... | github_jupyter |
# FloPy
## MODPATH example
This notebook demonstrates how to create and run forward and backward tracking with MODPATH. The notebooks also shows how to create subsets of pathline and endpoint information, plot MODPATH results on ModelMap objects, and export endpoints and pathlines as shapefiles.
```
import sys
import... | github_jupyter |
# Resample Data
## Pandas Resample
You've learned about bucketing to different periods of time like Months. Let's see how it's done. We'll start with an example series of days.
```
import numpy as np
import pandas as pd
dates = pd.date_range('10/10/2018', periods=11, freq='D')
close_prices = np.arange(len(dates))
cl... | github_jupyter |
# Getting Started: Sensitivity Analysis
To start analyzing tree diversity, it's important to check if how sensistive your dataset is to the number of trees in the city center geographic boundary. The two diversity (entropy) indices used below are both impacted by the number of members in a sample, so this notebook wal... | github_jupyter |
# Python for scientific computing
> Marcos Duarte
> Laboratory of Biomechanics and Motor Control ([http://pesquisa.ufabc.edu.br/bmclab/](http://pesquisa.ufabc.edu.br/bmclab/))
> Federal University of ABC, Brazil
The [Python programming language](https://www.python.org/) with [its ecosystem for scientific programm... | github_jupyter |
```
import os
from tinytag import TinyTag, TinyTagException
from sklearn.neighbors import NearestNeighbors
from collections import defaultdict
from keras.models import load_model
import librosa
from collections import Counter
import multiprocessing
from tqdm import tqdm
from keras.models import Model
import numpy as np... | github_jupyter |
# Solver - Tutorial
## Non colliding fiber models
An important component of nerve fibers is that they are 3d objects.
Therefore, they should not overlap each other.
To achieve this, an [algorithm](https://arxiv.org/abs/1901.10284) was developed based on collision checking of conical objects.
A conical object is defin... | github_jupyter |
```
import pandas as pd
import numpy as np
import urllib.request
from zipfile import ZipFile
from re import compile
from pathlib import Path
from shutil import rmtree
deis_data = Path('deis_data')
deis_data.mkdir(parents=True, exist_ok=True)
def get_deis_death_url():
datapattern = compile('http.*DEFUNCIONES_FUENTE... | github_jupyter |
# Demo of the LCS package
```
#preamble
import os, sys
import pandas as pd
import numpy as np
import random
import pickle
```
## Import Package
```
# how to import the packaes
from Rulern.LCSModule import LCS # the core library
from Rulern.RuleModule import Rule # this is only needed if you create your o... | github_jupyter |
# Hyper-parameter Tunning of Machine Learning (ML) Models
### Code for Classification Problems
#### `Dataset Used:`
MNIST dataset
#### `Machine Learning Algorithm Used:`
* Random Forest (RF)
* Support Vector Machine (SVM)
* K-Nearest Neighbor (KNN)
* Artificial Neural Network (ANN)
#### `Hyper-parameter Tuning A... | github_jupyter |
# Exploring MNIST Manifolds
** November 2017 **
** Andrew Riberio @ [AndrewRib.com](http://www.andrewrib.com) **
Pg 158 of the [Deep Learning Book](http://www.deeplearningbook.org/), "In the case of images, we can certainly think of many possible transformations that allow us to trace out a manifold in image space: w... | 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 |
# Electronic structure
## Introduction
The molecular Hamiltonian is
$$
\mathcal{H} = - \sum_I \frac{\nabla_{R_I}^2}{M_I} - \sum_i \frac{\nabla_{r_i}^2}{m_e} - \sum_I\sum_i \frac{Z_I e^2}{|R_I-r_i|} + \sum_i \sum_{j>i} \frac{e^2}{|r_i-r_j|} + \sum_I\sum_{J>I} \frac{Z_I Z_J e^2}{|R_I-R_J|}
$$
Because the nuclei ar... | github_jupyter |
```
#The first cell is just to align our markdown tables to the left vs. center
%%html
<style>
table {float:left}
</style>
```
# Python Dictionaries
## Student Notes
***
## Learning Objectives
In this lesson you will:
1. Learn the fundamentals of dictionaries in Python
2. Work with dictionaries in Py... | github_jupyter |
# COVID-19 comparison using Pie charts
Created by (c) Shardav Bhatt on 17 June 2020
# 1. Introduction
Jupyter Notebook Created by Shardav Bhatt
Data (as on 16 June 2020)
References:
1. Vadodara: https://vmc.gov.in/coronaRelated/covid19dashboard.aspx
2. Gujarat: https://gujcovid19.gujarat.gov.in/
3. India: https://... | github_jupyter |
## In this notebook we are going to Predict the Growth of Apple Stock using Linear Regression Model and CRISP-DM.
```
#importing the libraries
import numpy as np
import pandas as pd
from sklearn import metrics
%matplotlib inline
import matplotlib.pyplot as plt
import math
from sklearn.linear_model import LinearRegress... | github_jupyter |
# Beginner's Python—Session Two Finance/Economics Answers
## Analysing blue-chip stocks
Figures 1, 2, 3, and 4 below illustrate the stock price time series of four different tech companies (Apple, Facebook, Amazon and Netflix) over the last year. We will use this data to derive some insights on these stocks during th... | github_jupyter |
# COVID-19 evolution in French departments
#### <br> Visualize evolution of the number of people hospitalized in French departments due to COVID-19 infection
```
%load_ext lab_black
%matplotlib inline
from IPython.display import HTML
import requests
import zipfile
import io
from datetime import timedelta, date
import... | github_jupyter |
# **Demos of MultiResUNet models implemented on the CelebAMaskHQ dataset**
In this notebook, we display demos of the models tested using the mechanisms mentioned in [MultiResUNet.ipynb](https://drive.google.com/file/d/1H26uaN10rU2V7MnX8vRdE3J0ZMoO7wq2/view?usp=sharing).
This demo should work irrespective of any access ... | github_jupyter |
# 阅读笔记
** 作者:方跃文 **
** Email: fyuewen@gmail.com **
** 时间:始于2017年9月12日, 结束写作于 **
** 第二章笔记始于2017年9月12日,第一阶段结束语2017年9月28日晚(剩余两个分析案例)**
# 第二章 引言
** 时间: 2017年9月12日 **
尽管数据处理的目的和领域都大不相同,但是利用python数据处理时候基本都需要完成如下几个大类的任务:
1) 与外界进行数据交互
2) 准备:对数据进行清理、修整、规范化、重塑、切片切块
3) 转换:对数据集做一些数学和统计运算以产生新的数据集,e.g. 根据分组变量对一个大表进行聚合
... | github_jupyter |
# References
## Custom Code
**Doesnt Work**
```
import csv
from itertools import combinations
def read_data(file_loc='/content/GroceryStoreDataSet.csv'):
trans = dict()
with open(file_loc) as f:
filedata = csv.reader(f, delimiter=',')
count = 0
for line in filedata:
count... | github_jupyter |
```
'''
ID3 Algorithm
Muskan Pandey
'''
import csv
import math
import os
def load_csv_to_header_data(filename):
fpath = os.path.join(os.getcwd(), filename)
fs = csv.reader(open(fpath, newline='\n'))
all_row = []
for r in fs:
all_row.append(r)
headers = all_row[0]
idx_to_name, name_to_i... | github_jupyter |
WNixalo
2018/2/11 17:51
[Homework No.1](https://github.com/fastai/numerical-linear-algebra/blob/master/nbs/Homework%201.ipynb)
```
%matplotlib inline
import numpy as np
import torch as pt
import matplotlib.pyplot as plt
plt.style.use('seaborn')
```
## 1.
---
1. Consider the polynomial $p(x) = (x-2)^9 = x^9 - 18... | github_jupyter |
# Chapter 6: Physiological and Psychological State Detection in IoT
# Use Case 1: Human Activity Recognition (HAR)
# Model: LSTM
# Step 1: Download Dataset
```
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
from scipy import stats
import tensorflow as tf
import seaborn as sns
f... | github_jupyter |
## Uncertainty estimation for regression
We would demonstrate how to estimate the uncertainty for a regression task. In this case we treat uncertainty as a standard deviation for test data points.
As an example dataset we take the kinemtic movement data from UCI database and would estimate the uncertainty prediction wi... | github_jupyter |
```
# Copyright 2021 Google LLC
#
# 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 agreed to in writi... | github_jupyter |
```
from pathlib import Path
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
tests = pd.read_csv('tests.csv')
utility = pd.read_csv('utility.csv')
train = pd.read_csv('train.csv')
welfare = pd.read_csv('welfare.csv')
train.update(tests)
# Insert Revenue and Regret from test_data into train_d... | github_jupyter |
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
```
# Supervised Learning Part b - Decision Trees and Forests (optional)
Here we'll explore a class of algorithms based on decision trees. Decision trees are at their root extremely intuitive. They
encode a series of "if" and "else" choices, si... | github_jupyter |
[User Struggles <](10_Struggles.ipynb) | [> Use of Special Features](12_Magic.ipynb)
# What can we learn about API design for data science?
There are a lot of different ways of spelling out functionality in APIs and some of them are painful, while others are highly usable. We may be able to learn things about A... | github_jupyter |
# Fully Bayesian inference for generalized GP models with HMC
*James Hensman, 2015-16*
Converted to candlegp *Thomas Viehmann*
It's possible to construct a very flexible models with Gaussian processes by combining them with different likelihoods (sometimes called 'families' in the GLM literature). This makes inferen... | github_jupyter |
# Batch Normalization
Training deep models is difficult and getting them
to converge in a reasonable amount of time can be tricky.
In this section, we describe batch normalization,
one popular and effective technique
that has been found to accelerate the convergence of deep nets
and ([together with residual blocks,... | github_jupyter |
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import category_encoders as ce
from sklearn.impute import SimpleImputer
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pi... | github_jupyter |
# Co-refinement of multiple contrast DMPC datasets in *refnx*
This Jupyter notebook demonstrates the utility of the *refnx* package for analysis of neutron reflectometry data. Specifically:
- the co-refinement of three contrast variation datasets of a DMPC (1,2-dimyristoyl-sn-glycero-3-phosphocholine) bilayer measur... | github_jupyter |
```
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
import datetime
from typing import Union
sns.set_theme(style="whitegrid")
```
## Analyze CS Data
```
df = pd.read_csv("data/cs.csv",... | github_jupyter |
# Creating a logistic regression to predict absenteeism
## Import the relevant libraries
```
# import the relevant libraries
import pandas as pd
import numpy as np
```
## Load the data
```
# load the preprocessed CSV data
data_preprocessed = pd.read_csv('Absenteeism_preprocessed.csv')
# eyeball the data
data_prepro... | github_jupyter |
# <center> Step 1.1 Attempt to Import and Transform Data with PyCaret </center> #
In this notebook, I attempted to import, transform, and clean data using the setup() function in PyCaret. From this experiment, my conclusion is that PyCaret may not be a "one-stop shop" solution for data cleaning, data imputing, and cre... | github_jupyter |
## Instructions
- Run all cells to initialize app (`Menu Bar > Kernel > Restart & Run All`)
- Select a system ID with data picker, text input, or key selection (see below)
- When ready, run SCSF algorithm by clicked red button (caution: this could take a few minutes to complete)
- Re-run last cell of notebook (`view_t... | github_jupyter |
```
# Copyright 2020 Google LLC
#
# 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 agreed to in writi... | github_jupyter |
# Chapter 6 - Model Deployment for Time Series Forecasting - Serving
## Deployment
This script allows you to use the model in a webservice and get the desired results.
Once the model is trained, it's possible to deploy it in a service.
#### For this you need the following steps:
* Retrieve the workspace
* Get o... | github_jupyter |
# Forest Inference Library (FIL)
The forest inference library is used to load saved forest models of xgboost, lightgbm or protobuf and perform inference on them. It can be used to perform both classification and regression. In this notebook, we'll begin by fitting a model with XGBoost and saving it. We'll then load the... | github_jupyter |
# Using Mitiq with Qiskit quantum programs
This notebook shows how to use Mitiq to mitigate errors in Qiskit quantum programs.
**This has been adapted to mitigate error from a 16-bit floating point build of Qrack, as a "noisy simulator".**
Truncation error (to improve execution time) of simulation motivates a use ca... | github_jupyter |
# Import Modules
```
import sys
import numpy as np
import pandas as pd
sys.path.insert(0, "..")
from local_methods import compare_rdf_ij
# #########################################################
import pickle; import os
path_i = os.path.join(
os.environ["HOME"],
"__temp__",
"temp_2.pickle")
with open(... | github_jupyter |
# Chapter 1 Tutorial
You can use NetworkX to construct and draw graphs that are undirected or directed, with weighted or unweighted edges. An array of functions to analyze graphs is available. This tutorial takes you through a few basic examples and exercises.
Note that many exercises are followed by a block with som... | github_jupyter |
```
%matplotlib inline
from pyvista import set_plot_theme
set_plot_theme('document')
```
# Export a GemPy Model to MOOSE
This section briefly describes how to export a GemPy model to get a working input file for MOOSE.
This example is mainly taken from the tutorial `gempy export MOOSE <https://github.com/cgre-aache... | github_jupyter |
# Videos and Exercises for Session 2: Data Structuring in Pandas I
In this combined teaching module and exercise set, you will be working with structuring data.
We will start out with a recap of some basic function and methods that become available in pandas. Then there will be a short intermezzo, where you will be ... | github_jupyter |
# Image Segmentation U-Net
+ [https://ithelp.ithome.com.tw/articles/10240314](https://ithelp.ithome.com.tw/articles/10240314)
+ [https://www.kaggle.com/tikutiku/hubmap-tilespadded-inference-v2](https://www.kaggle.com/tikutiku/hubmap-tilespadded-inference-v2)
這次改用 kaggle HuBMAP 腎絲球辨識競賽第一名所使用的模型
主要也是 U-Net 的架構,在 Encod... | github_jupyter |
<p><font size="6"><b>Numpy</b></font></p>
> *DS Python for GIS and Geoscience*
> *October, 2020*
>
> *© 2020, Joris Van den Bossche and Stijn Van Hoey. Licensed under [CC BY 4.0 Creative Commons](http://creativecommons.org/licenses/by/4.0/)*
---
```
import matplotlib.pyplot as plt
from matplotlib.colors import Li... | github_jupyter |
```
from google.colab import drive
drive.mount('/content/drive')
import os
os.chdir('drive/My Drive/Colab Notebooks/ML_and_NN_course/module 1')
cwd=os.getcwd()
print(cwd)
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from utils import *
data = pd.read_csv('train_data.csv', sep = ',')
data.head(... | github_jupyter |
```
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from tqdm import tqdm
%matplotlib inline
from torch.utils.data import Dataset, DataLoader
import torch
import torchvision
import torch.nn as nn
import torch.optim as optim
from torch.nn import functional as F
device = torch.device("cuda" i... | github_jupyter |
```
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from astropy import time as astropytime
from ctapipe.io import EventSource, EventSeeker
from ctapipe.visualization import CameraDisplay
from ctapipe.instrument import CameraGeometry
from ctapipe.image import tailcuts_clean, dilate, hillas_p... | github_jupyter |
[](http://rpi.analyticsdojo.com)
<center><h1>Linear Regression</h1></center>
<center><h3><a href = 'http://introml.analyticsdojo.com'>introml.analyticsdojo.com</a></h3></center>
# Linear Regression
Adopt... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.

# Automated Machine Learning
_**... | github_jupyter |
```
import os
import numpy as np
import pandas as pd
import pystan
from astropy.table import Table
import matplotlib.pyplot as plt
%matplotlib inline
import corner
import random
```
load csv files on ESA vo space
```
lensedQSO = pd.read_csv("http://vospace.esac.esa.int/vospace/sh/baf64b11fe35d35f18879b1d292b0c4b02286... | github_jupyter |
# Week 4 Assignment: Custom training with tf.distribute.Strategy
Welcome to the final assignment of this course! For this week, you will implement a distribution strategy to train on the [Oxford Flowers 102](https://www.tensorflow.org/datasets/catalog/oxford_flowers102) dataset. As the name suggests, distribution stra... | github_jupyter |
# Hate speech classification by k-fold cross validation on movies dataset
The class labels depict the following:
0: Normal speech,
1: Offensive speech
2: Hate speech
#### To work with this, the following folder paths needs to be created in the directory of this notebook:
classification_reports/ : This will cont... | github_jupyter |
# Feature Exploration for Proxy Model
- have many different feature models (by prefix)
- do boxplot and PCA for features
```
!pip install git+https://github.com/IBM/ibm-security-notebooks.git
# Default settings, constants
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
pd.se... | github_jupyter |
```
import keras
keras.__version__
```
# 5.1 - Introduction to convnets
This notebook contains the code sample found in Chapter 5, Section 1 of [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid=76564dff). Note that the original text features far more content, in par... | github_jupyter |
```
from PIL import Image
from IPython.display import display
import random
import json
import os
import glob
PROJECT_NAME = "PFP Test"
TOTAL_IMAGES = 5 # Number of random unique images we want to generate
IMAGES_BASE_URI = "https://gateway.pinata.cloud/ipfs/"
METADATA_PATH = './output/';
IMAGES_PATH = './output/';
M... | github_jupyter |
<style>
pre {
white-space: pre-wrap !important;
}
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #f9f9f9;
}
.table-striped > tbody > tr:nth-of-type(even) {
background-color: white;
}
.table-striped td, .table-striped th, .table-striped tr {
border: 1px solid black;
border-collapse: co... | github_jupyter |
# Introduction to Programming - Lecture 3
### Material covered :
1. Conditional statement "if" and Logical Operators
2. For loops
## If-else and Logical Operators
"If" is the simplest conditional statement. It simply checks if an evaluation condition is True and if it is then it executes a certain bloc... | github_jupyter |
## Code Setup
```
%load_ext autoreload
%autoreload 2
import math
from functools import partial
import numpy as np
from xgboost import XGBClassifier, XGBRegressor
from sklearn.pipeline import make_pipeline
from sklearn.base import clone, BaseEstimator, TransformerMixin, ClassifierMixin
from sklearn.preprocessing impo... | github_jupyter |
__Author: Manu Jayadharan, University of Pittsburgh, 2020__
# Solving difussion equation using its mixed form.
We have a system of equation to solve: $p_t + \nabla\cdot u -f = 0$ and $-\nabla p = u$,
over domain $\Omega$ from time T_initial to T_final.
Variables $p$ and $u$ has the physical meaning of pressure an... | github_jupyter |
# MO434 - Final S2
## Physionet Challenge 2020
## Code loading
Firstly, the training, inference and evaluation scripts are loaded from the remote repository.
```
!git clone -b v1.0-rc2 https://github.com/Kotzly/physionet-challenge-2020.git
```
## Data Loading
Then the datasets are download, they are 6 in tota... | github_jupyter |
# k-NN: finding optimal weight function ('distance' or 'uniform')
```
"""k-NN: finding optimal weight function ('distance' or 'uniform')
"""
# import libraries
import pandas as pd
import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
from sklearn.model_selection impor... | github_jupyter |
# MiRAC-P
The following example presents the nadir passive microwave radiometer MiRAC-P. The Microwave Radar/Radiometer for Arctic Clouds - passive (MiRAC-P) was installed during ACLOUD and AFLUX. During MOSAiC-ACA, passive microwave observations are conducted by the HATPRO instrument.
More information on MiRAC can be... | github_jupyter |
##### Copyright 2018 The TensorFlow Authors.
```
# ATTENTION: Please do not alter any of the provided code in the exercise. Only add your own code where indicated
# ATTENTION: Please do not add or remove any cells in the exercise. The grader will check specific cells based on the cell position.
# ATTENTION: Please use... | github_jupyter |
# Changing R plot options in Jupyter
To use R with Jupyter, under the hood the service runs the IRKernel. This kernel communicates between R and the Jupyter service.
IRKernel allows you to specify different options for plotting. For example, you can change:
* whether to display images as SVG or PNG
* the plot size
... | github_jupyter |
```
from toolbox.processing import *
#%ls /home/stewart/su/2d_land_data/2D_Land_data_2ms/
file = "/home/stewart/su/2d_land_data/2D_Land_data_2ms/su/Line_001.su"
#file = "/home/sfletcher/Downloads/2d_land_data/2D_Land_data_2ms/Line_001.su"
#initialise file
data, params = initialise(file)
#no coordinates in the headers, ... | github_jupyter |
# Think Bayes: Chapter 11
This notebook presents code and exercises from Think Bayes, second edition.
Copyright 2016 Allen B. Downey
MIT License: https://opensource.org/licenses/MIT
```
from __future__ import print_function, division
% matplotlib inline
import warnings
warnings.filterwarnings('ignore')
import mat... | github_jupyter |
# Dictionaries {"Java" => "Maps", "Python" => "Dictionaries"}
Python has a structure called a dictionary which is very similar to Java's `Map`. It is pretty similar to use them, with only some syntactic differences. In Java
```java
Map<String, Integer> students = new HashMap<String, Integer>();
students.put("Josh", 1... | github_jupyter |
# Predicting Time Series Data
> If you want to predict patterns from data over time, there are special considerations to take in how you choose and construct your model. This chapter covers how to gain insights into the data before fitting your model, as well as best-practices in using predictive modeling for time seri... | github_jupyter |
```
%matplotlib inline
```
# Main file subgraph
This is the main file for the subgraph classification task
```
import tensorflow as tf
import numpy as np
import gnn_utils
import GNN as GNN
import Net_Subgraph as n
from scipy.sparse import coo_matrix
##### GPU & stuff config
import os
os.environ['CUDA_VISIBLE_DEVI... | github_jupyter |
# Imports
```
# Import pandas
import pandas as pd
# Import matplotlib
import matplotlib.pyplot as plt
# Import numpy
import numpy as np
# Import Network X
import networkx as nx
```
# Getting the data
## Paths for in.out files
```
# Path of IN-labels
mesh_path = '../../data/final/mesh.pkl'
# Path for IN-tags
ge... | github_jupyter |
```
from sqlalchemy import create_engine, select, and_, or_
from sqlalchemy import MetaData, create_engine
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import select, and_, literal, bindparam, exists
from sqlalchemy.ext.declarative import declarative_base
from ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.