text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
```
#import all the dependencies
import os
import csv
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#read the csv files to view the data
google_apps = pd.read_csv("googleplaystore.csv")
google_apps.shape
```
# Data Cleaning
```
#Check for number of apps in total
no_apps = google_apps["App"... | github_jupyter |
###### ECE 283: Homework 2
###### Topics: Classification using neural networks
###### Due: Monday April 30
- Neural networks; Tensorflow
- 2D synthetic gaussian mixture data for binary classification
### Report
----------------------------------------
##### 1. Tensorflow based neural network
- 2D Gaussian mixture ... | github_jupyter |
```
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
from sklearn.neighbors import KDTree
from sklearn.decomposition import PCA
#### Visulization imports
import pandas_profiling
import plotly.express as px
import seaborn as sns
import p... | github_jupyter |
# Measuring PROV Provenance on the Web of Data
* Authors:
* [Paul Groth](http://pgroth.com), [Elsevier Labs](http://labs.elsevier.com)
* [Wouter Beek](http://www.wouterbeek.com), Vrije Universiteit Amsterdam
* Date: May 11, 2016
One of the motivations behind the original charter for the [W3C Provenance Incub... | github_jupyter |
```
# Import required modules
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.ensemble import AdaBoostClassifier, GradientBoostingClassifier, BaggingClassifier, RandomForestClassifier, VotingClassifier
from sklearn.tree import DecisionTreeClassifie... | github_jupyter |
# Predicting movie ratings
One of the most common uses of big data is to predict what users want. This allows Google to show you relevant ads, Amazon to recommend relevant products, and Netflix to recommend movies that you might like. This lab will demonstrate how we can use Apache Spark to recommend movies to a user.... | github_jupyter |
# Regresión con Redes Neuronales
Empleando diferentes *funciones de pérdida* y *funciones de activación* las **redes neuronales** pueden resolver
efectivamente problemas de **regresión.**
En esta libreta se estudia el ejemplo de [California Housing](http://www.spatial-statistics.com/pace_manuscripts/spletters_ms_dir/s... | github_jupyter |
```
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
data_path = '../results/results.csv'
df = pd.read_csv(data_path, delimiter='\t')
ray = df['Ray_et_al'].to_numpy()
matrixreduce = df['MatrixREDUCE'].to_numpy()
rnacontext = df['RNAcontext'].to_numpy()
deepbind = df['D... | github_jupyter |
## Fish classification
In this notebook the fish classification is done. We are going to classify in four classes: Tuna fish (TUNA), LAG, DOL and SHARK. The detector will save the cropped image of a fish. Here we will take this image and we will use a CNN to classify it.
In the original Kaggle competition there are s... | github_jupyter |
# Uptake of carbon, heat, and oxygen
Plotting a global map of carbon, heat, and oxygen uptake
```
from dask.distributed import Client
client = Client("tcp://10.32.15.112:32829")
client
%matplotlib inline
import xarray as xr
import intake
import numpy as np
from cmip6_preprocessing.preprocessing import read_data
fro... | github_jupyter |
### Halo check
Plot halos to see if halofinders work well
```
#import os
#base = os.path.abspath('/home/hoseung/Work/data/05427/')
#base = base + '/'
# basic parameters
# Directory, file names, snapshots, scale, npix
base = '/home/hoseung/Work/data/05427/'
cluster_name = base.split('/')[-2]
frefine= 'refine_params.t... | github_jupyter |
# WGAN with MNIST (or Fashion MNIST)
* `Wasserstein GAN`, [arXiv:1701.07875](https://arxiv.org/abs/1701.07875)
* Martin Arjovsky, Soumith Chintala, and L ́eon Bottou
* This code is available to tensorflow version 2.0
* Implemented by [`tf.keras.layers`](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/... | github_jupyter |
```
from keras.models import Sequential
from keras.layers import Dense
from keras.callbacks import TensorBoard
from keras.layers import *
import numpy
from sklearn.model_selection import train_test_split
#ignoring the first row (header)
# and the first column (unique experiment id, which I'm not using here)
dataset ... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/canny_edge_detector.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blank" hr... | github_jupyter |
# Gaussian Mixture Model
```
!pip install tqdm torchvision tensorboardX
from __future__ import print_function
import torch
import torch.utils.data
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
seed = 0
torch.manual_seed(seed)
if torch.cuda.is_av... | github_jupyter |
# Import libraries
```
import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import r2_score
from sklearn.metrics import mean_absolute_error
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GridSearchCV
import matplotlib.p... | github_jupyter |
<a href="https://colab.research.google.com/github/gdg-ml-team/ioExtended/blob/master/Lab_2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!pip install -q tensorflow_hub
from __future__ import absolute_import, division, print_function
import ma... | github_jupyter |
<a href="https://practicalai.me"><img src="https://raw.githubusercontent.com/practicalAI/images/master/images/rounded_logo.png" width="100" align="left" hspace="20px" vspace="20px"></a>
<img src="https://raw.githubusercontent.com/practicalAI/images/master/images/02_Numpy/numpy.png" width="200" vspace="30px" align="rig... | github_jupyter |
**This notebook is an exercise in the [Introduction to Machine Learning](https://www.kaggle.com/learn/intro-to-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/dansbecker/underfitting-and-overfitting).**
---
## Recap
You've built your first model, and now it's time to op... | github_jupyter |
```
import pandas as pd
import numpy as np
import emoji
import pickle
import cv2
import matplotlib.pyplot as plt
import os
sentiment_data = pd.read_csv("../../resource/Emoji_Sentiment_Ranking/Emoji_Sentiment_Data_v1.0.csv")
sentiment_data.head()
def clean(x):
x = x.replace(" ", "-").lower()
return str(x)
senti... | github_jupyter |
# Computing the Bayesian Hilbert Transform-DRT
In this tutorial example, we will show how the developed BHT-DRT method works using a simple ZARC model. The equivalent circuit consists one ZARC model, *i.e*., a resistor in parallel with a CPE element.
```
# import the libraries
import numpy as np
from math import pi, ... | github_jupyter |
```
from functools import reduce
import numpy as np
import pandas as pd
from pandas.tseries.offsets import DateOffset
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from xgboost imp... | github_jupyter |
# Python Data Science
> Dataframe Wrangling with Pandas
Kuo, Yao-Jen from [DATAINPOINT](https://www.datainpoint.com/)
```
import requests
import json
from datetime import date
from datetime import timedelta
```
## TL; DR
> In this lecture, we will talk about essential data wrangling skills in `pandas`.
## Essenti... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Part 1: Training Tensorflow 2.0 Model on Azure Machine Learning Service
## Overview of the part 1
This notebook is Part 1 (Preparing Data and Model Training) of a two part workshop that demonstrates an end-to-end workflow usi... | github_jupyter |
# Introduction
© Harishankar Manikantan, maintained on GitHub at [hmanikantan/ECH60](https://github.com/hmanikantan/ECH60) and published under an [MIT license](https://github.com/hmanikantan/ECH60/blob/master/LICENSE).
Return to [Course Home Page](https://hmanikantan.github.io/ECH60/)
**[Context and Scope](#scop... | github_jupyter |
# Softmax exercise
*Complete and hand in this completed worksheet (including its outputs and any supporting code outside of the worksheet) with your assignment submission. For more details see the [assignments page](http://vision.stanford.edu/teaching/cs231n/assignments.html) on the course website.*
This exercise is ... | github_jupyter |
## Week 2-2 - Visualizing General Social Survey data
Your mission is to analyze a data set of social attitudes by turning it into vectors, then visualizing the result.
### 1. Choose a topic and get your data
We're going to be working with data from the General Social Survey, which asks Americans thousands of questio... | github_jupyter |
```
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.ensemble import RandomForestClassifier
from sklearn import svm
from sklearn.metrics import precision_score, recall_score
import matplotlib.pyplot as plt
#reading train.csv
data ... | github_jupyter |
# Extracting training data from the ODC <img align="right" src="../../Supplementary_data/dea_logo.jpg">
* [**Sign up to the DEA Sandbox**](https://docs.dea.ga.gov.au/setup/sandbox.html) to run this notebook interactively from a browser
* **Compatibility:** Notebook currently compatible with the `DEA Sandbox` environm... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
%matplotlib inline
```
## Read in the data
*I'm using pandas*
```
data = pd.read_csv('bar.csv')
data
```
## Here is the default bar chart from python
```
f,ax = plt.subplots()
ind = np.arange(len(data)) # the x loc... | github_jupyter |
```
import sys
sys.path.append('../src')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import plotly.graph_objects as go
import plotly.express as px
pd.set_option('display.max_rows', None)
import datetime
from plotly.subplots import make_subplots
from covid19.config import covid_19_data
data ... | github_jupyter |
# Introduction to Band Ratios & Spectral Features
The BandRatios project explore properties of band ratio measures.
Band ratio measures are an analysis measure in which the ratio of power between frequency bands is calculated.
By 'spectral features' we mean features we can measure from the power spectra, such as pe... | github_jupyter |
# Bayesian Curve Fitting
### Overview
The predictive distribution resulting from a Baysian treatment of polynominal curve fittting using an $M = 9$ polynominal, with the fixed parameters $\alpha = 5×10^{-3}$ and $\beta = 11.1$ (Corresponding to known noise variance), in which the red curve denotes the mean of the pred... | github_jupyter |
```
''' setting before run. every notebook should include this code. '''
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
import sys
_r = os.getcwd().split('/')
_p = '/'.join(_r[:_r.index('gate-decorator-pruning')+1])
print('Change dir from %s to %s' % (os.getcwd(), _p))
o... | github_jupyter |
# Cavity flow with Navier-Stokes
The final two steps will both solve the Navier–Stokes equations in two dimensions, but with different boundary conditions.
The momentum equation in vector form for a velocity field v⃗
is:
$$ \frac{\partial \overrightarrow{v}}{\partial t} + (\overrightarrow{v} \cdot \nabla ) \overri... | github_jupyter |
```
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from TutorML.decomposition import LFM
def load_movielens(train_path, test_path, basedir=None):
if basedir:
train_path = os.path.join(basedir,train_path)
test_path = os.path.join(basedir,test_path)
col_names = ['... | github_jupyter |
# Setup
```
from warnings import simplefilter
simplefilter(action='ignore', category=FutureWarning)
from tensorflow.keras import backend as K
from tensorflow.keras.models import Model, load_model, clone_model
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.layers import Activation
from sklear... | github_jupyter |
Here is a simple example of file IO:
```
#Write a file
out_file = open("test.txt", "w")
out_file.write("This Text is going to out file\nLook at it and see\n")
out_file.close()
#Read a file
in_file = open("test.txt", "r")
text = in_file.read()
in_file.close()
print(text)
```
The output and the contents of the file t... | github_jupyter |
```
# accessing documentation with ?
# We can use help function to understand the documentation
print(help(len))
# or we can use the ? operator
len?
# The notation works for objects also
L = [1,2,4,5]
L.append?
L?
# This will also work for functions that we create ourselves, the ? returns the doc string in the funct... | github_jupyter |
# Imports
```
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from pymongo import MongoClient
import csv
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import spacy
import tweepy
```
# Help-Functions
```
def open_csv(csv_address):
'''Loading CSV document with ... | github_jupyter |
# Data Prep of Chicago Food Inspections Data
This notebook reads in the food inspections dataset containing records of food inspections in Chicago since 2010. This dataset is freely available through healthdata.gov, but must be provided with the odbl license linked below and provided within this repository. This note... | 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 |
# Markov Decision Process (MDP)
# Discounted Future Return
$$R_t = \sum^{T}_{k=0}\gamma^{t}r_{t+k+1}$$
$$R_0 = \gamma^{0} * r_{1} + \gamma^{1} * r_{2} = r_{1} + \gamma^{1} * r_{2}\ (while\ T\ =\ 1) $$
$$R_1 = \gamma^{1} * r_{2} =\ (while\ T\ =\ 1) $$
$$so,\ R_0 = r_{1} + R_1$$
Higher $\gamma$ stands for lower disco... | github_jupyter |
<img src="../figures/HeaDS_logo_large_withTitle.png" width="300">
<img src="../figures/tsunami_logo.PNG" width="600">
[](https://colab.research.google.com/github/Center-for-Health-Data-Science/PythonTsunami/blob/intro/Numbers_and_operators/Numb... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
%matplotlib inline
import sklearn
sklearn.set_config(print_changed_only=True)
```
## Automatic Feature Selection
### Univariate statistics
```
from sklearn.datasets import load_breast_cancer
from sklearn.feature_selection import SelectPercenti... | github_jupyter |
### EXP: Pilote2 QC rating
- **Aim:** Test reliability of quality control (QC) of brain registration ratings between two experts raters (PB: Pierre Bellec, YB: Yassine Benahajali) based on the first drafted qc protocol on the zooniverse platform ( ref: https://www.zooniverse.org/projects/simexp/brain-match ).
- **Exp... | github_jupyter |
<a href="https://colab.research.google.com/github/mrdbourke/tensorflow-deep-learning/blob/main/05_transfer_learning_in_tensorflow_part_2_fine_tuning.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# 05. Transfer Learning with TensorFlow Part 2: Fine... | github_jupyter |
```
# This notebook demonstrates using bankroll to load positions across brokers
# and highlights some basic portfolio rebalancing opportunities based on a set of desired allocations.
#
# The default portfolio allocation is described (with comments) in notebooks/Rebalance.example.ini.
# Copy this to Rebalance.ini in th... | github_jupyter |
# 1. Event approach
## Reading the full stats file
```
import numpy
import pandas
full_stats_file = '/Users/irv033/Downloads/data/stats_example.csv'
df = pandas.read_csv(full_stats_file)
def date_only(x):
"""Chop a datetime64 down to date only"""
x = numpy.datetime64(x)
return numpy.datetime64(... | github_jupyter |
# The effect of steel casing in AEM data
Figures 4, 5, 6 in Kang et al. (2020) are generated using this
```
# core python packages
import numpy as np
import scipy.sparse as sp
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from scipy.constants import mu_0, inch, foot
import ipywidgets
import pr... | github_jupyter |
```
import numpy as np
import pandas as pd
import torch
import torchvision
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from matplotlib import pyplot as plt
%matplotlib inline
torch.backends... | github_jupyter |
## 2-3. 量子フーリエ変換
この節では、量子アルゴリズムの中でも最も重要なアルゴリズムの一つである量子フーリエ変換について学ぶ。
量子フーリエ変換はその名の通りフーリエ変換を行う量子アルゴリズムであり、様々な量子アルゴリズムのサブルーチンとしても用いられることが多い。
(参照:Nielsen-Chuang 5.1 `The quantum Fourier transform`)
※なお、最後のコラムでも多少述べるが、回路が少し複雑である・入力状態を用意することが難しいといった理由から、いわゆるNISQデバイスでの量子フーリエ変換の実行は難しいと考えられている。
### 定義
まず、$2^n$成分の配列 $\... | github_jupyter |
# Lab 2: cleaning operations practice with the Adult dataset
In this lab, we will practice what we learned in the clearning operations lab, but now we use a larger dataset, __Adult__, which we already used in the previous lab . We start by loading the data as we have done before, as well as the necessary libraries. We ... | github_jupyter |
# CA Coronavirus Cases and Deaths Trends
CA's [Blueprint for a Safer Economy](https://www.cdph.ca.gov/Programs/CID/DCDC/Pages/COVID-19/COVID19CountyMonitoringOverview.aspx) assigns each county [to a tier](https://www.cdph.ca.gov/Programs/CID/DCDC/Pages/COVID-19/COVID19CountyMonitoringOverview.aspx) based on case rate ... | github_jupyter |
```
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
sess_config = tf.ConfigProto(gpu_options=tf.GPUOptions(allow_growth=True))
np.random.seed(219)
tf.set_random_seed(219)
# Load training and eval data from tf.ker... | github_jupyter |
# Simulators
## Introduction
This notebook shows how to import the *Qiskit Aer* simulator backend and use it to run ideal (noise free) Qiskit Terra circuits.
```
import numpy as np
# Import Qiskit
from qiskit import QuantumCircuit
from qiskit import Aer, transpile
from qiskit.tools.visualization import plot_histogr... | github_jupyter |
```
repo_directory = '/Users/iaincarmichael/Dropbox/Research/law/law-net/'
data_dir = '/Users/iaincarmichael/Documents/courtlistener/data/'
import numpy as np
import sys
import matplotlib.pyplot as plt
from scipy.stats import rankdata
from collections import Counter
# graph package
import igraph as ig
# our code
sy... | github_jupyter |
# Distance Based Statistical Method for Planar Point Patterns
**Authors: Serge Rey <sjsrey@gmail.com> and Wei Kang <weikang9009@gmail.com>**
## Introduction
Distance based methods for point patterns are of three types:
* [Mean Nearest Neighbor Distance Statistics](#Mean-Nearest-Neighbor-Distance-Statistics)
* [Near... | github_jupyter |
```
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.per_process_gpu_memory_fraction = 0.3
tf.Session(config=config)
import keras
from keras.models import *
from keras.layers import *
from keras import optimizers
from keras.applications.resnet50 import ResNet5... | github_jupyter |
# Loss and Regularization
```
%load_ext autoreload
%autoreload 2
import numpy as np
from numpy import linalg as nplin
from cs771 import plotData as pd
from cs771 import optLib as opt
from sklearn import linear_model
from matplotlib import pyplot as plt
from matplotlib.ticker import MaxNLocator
import random
```
**Loa... | github_jupyter |
# Import statements
```
from google.colab import drive
drive.mount('/content/drive')
from my_ml_lib import MetricTools, PlotTools
import os
import numpy as np
import matplotlib.pyplot as plt
import pickle
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
import json
import dat... | github_jupyter |
#### From Quarks to Cosmos with AI: Tutorial Day 4
---
# Field-level cosmological inference with IMNN + DELFI
by Lucas Makinen [<img src="https://raw.githubusercontent.com/tlmakinen/FieldIMNNs/master/tutorial/plots/Orcid-ID.png" alt="drawing" width="20"/>](https://orcid.org/0000-0002-3795-6933 "") [<img src="https://r... | github_jupyter |
```
#hide
from perutils.nbutils import simple_export_all_nb,simple_export_one_nb
```
# Personal Utils (perutils)
> Notebook -> module conversion with #export flags and nothing else
**Purpose:** The purpose and main use of this module is for adhoc projects where a full blown nbdev project is not necessary
**Exampl... | github_jupyter |
```
import boto3
import botocore
import os
import sagemaker
bucket = sagemaker.Session().default_bucket()
prefix = "sagemaker/ipinsights-tutorial"
execution_role = sagemaker.get_execution_role()
region = boto3.Session().region_name
# check if the bucket exists
try:
boto3.Session().client("s3").head_bucket(Bucket... | github_jupyter |
# Table of Contents
<p><div class="lev1 toc-item"><a href="#ALGO1-:-Introduction-à-l'algorithmique" data-toc-modified-id="ALGO1-:-Introduction-à-l'algorithmique-1"><span class="toc-item-num">1 </span><a href="https://perso.crans.org/besson/teach/info1_algo1_2019/" target="_blank">ALGO1 : Introduction à l'al... | github_jupyter |
```
import pandas as pd
import numpy as np
```
## Load data from csv file
```
names = ['CRIM','ZN','INDUS','CHAS','NOX','RM','AGE','DIS','RAD','TAX','PTRATIO','B','LSTAT','PRICE']
df = pd.read_csv('https://archive.ics.uci.edu/ml/machine-learning-databases/housing/housing.data',
header=None, names=name... | github_jupyter |
```
from copy import deepcopy
import json
import pandas as pd
DATA_DIR = 'data'
# Define template payloads
CS_TEMPLATE = {
'resourceType': 'CodeSystem',
'status': 'draft',
'experimental': False,
'hierarchyMeaning': 'is-a',
'compositional': False,
'content': 'fragment',
'concept': []
}
```
... | github_jupyter |
## AutoGraph: examples of simple algorithms
This notebook shows how you can use AutoGraph to compile simple algorithms and run them in TensorFlow.
It requires the nightly build of TensorFlow, which is installed below.
```
!pip install -U -q tf-nightly-2.0-preview
import tensorflow as tf
tf = tf.compat.v2
tf.enable_... | github_jupyter |
# T81-558: Applications of Deep Neural Networks
**Module 7: Generative Adversarial Networks**
* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), McKelvey School of Engineering, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)
* For more information visit the... | github_jupyter |
```
#@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 agreed to in writing, software
# distributed u... | github_jupyter |
```
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import utils
matplotlib.rcParams['figure.figsize'] = (0.89 * 12, 6)
matplotlib.rcParams['lines.linewidth'] = 10
matplotlib.rcParams['lines.markersize'] = 20
```
# The Dataset
$$y = x^3 + x^2 - 4x$$
```
x, y, X, transform, sc... | github_jupyter |
```
#######################################################
# Script:
# trainPerf.py
# Usage:
# python trainPerf.py <input_file> <output_file>
# Description:
# Build the prediction model based on training data
# Pass 1: prediction based on hours in a week
# Authors:
# Jasmin Nakic, jnakic@salesforce.com
... | github_jupyter |
# Rotation Transformation
We meta-learn how to rotate images so that we can accurately classify rotated images. We use MNIST.
Import relevant packages
```
from operator import mul
from itertools import cycle
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.backends.cudnn... | github_jupyter |
In Ipython Notebook, I can write down the mathmatical expression with latex, which allows me to understand my codes better.
## q_3 word2vec.py
```
import numpy as np
import random
from q1_softmax import softmax
from q2_gradcheck import gradcheck_naive
from q2_sigmoid import sigmoid, sigmoid_grad
def normalizeRows(x)... | 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>
# Enforce conformal 3-metric $\det{\bar{\gamma}_{ij}}=\det{... | github_jupyter |
<div align="center"><h1>Perspectives on Text</h1>
<h3>_Synthesizing Textual Knowledge through Markup_</h3>
<br/>
<h4>Elli Bleeker, Bram Buitendijk, Ronald Haentjens Dekker, Astrid Kulsdom
<br/>R&D - Dutch Royal Academy of Arts and Science</h4>
<h6>Computational Methods for Literary Historical Textual Schola... | github_jupyter |
# Import
```
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import TensorDataset, Dataset, DataLoader, random_split
from torch.nn.utils.rnn import pack_padded_sequence, pack_sequence, pad_packed_sequence, pad_sequ... | github_jupyter |
# NLP - Hotel review sentiment analysis in python
```
#warnings :)
import warnings
warnings.filterwarnings('ignore')
import os
dir_Path = 'D:\\01_DATA_SCIENCE_FINAL\\D-00000-NLP\\NLP-CODES\\AMAN-NLP-CODES\\AMAN_NLP_VIMP-CODE\\Project-6_Sentiment_Analysis_Amn\\'
os.chdir(dir_Path)
```
## Data Facts and Import
```
im... | github_jupyter |
## TrainingPhase and General scheduler
Creates a scheduler that lets you train a model with following different [`TrainingPhase`](/callbacks.general_sched.html#TrainingPhase).
```
from fastai.gen_doc.nbdoc import *
from fastai.callbacks.general_sched import *
from fastai.vision import *
show_doc(TrainingPhase)
```
... | github_jupyter |
## Problem Definition
In the following different ways of loading or implementing an optimization problem in our framework are discussed.
### By Class
A very detailed description of defining a problem through a class is already provided in the [Getting Started Guide](../getting_started.ipynb).
The following definitio... | github_jupyter |
```
import os, platform, pprint, sys
import fastai
import keras
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sn
import sklearn
# from fastai.tabular.data import TabularDataLoaders
# from fastai.tabular.all import FillMissing, Categorify, N... | github_jupyter |
# Using AWS Lambda and PyWren for Landsat 8 Time Series
This notebook is a simple demonstration of drilling a timeseries of NDVI values from the [Landsat 8 scenes held on AWS](https://landsatonaws.com/)
### Credits
- NDVI PyWren - [Peter Scarth](mailto:p.scarth@uq.edu.au?subject=AWS%20Lambda%20and%20PyWren) (Joint Rem... | github_jupyter |
```
import xgboost as xgb
import pandas as pd
# 読み出し
data = pd.read_pickle('data.pkl')
nomination_onehot = pd.read_pickle('nomination_onehot.pkl')
selected_performers_onehot = pd.read_pickle('selected_performers_onehot.pkl')
selected_directors_onehot = pd.read_pickle('selected_directors_onehot.pkl')
selected_studio_one... | github_jupyter |
```
%tensorflow_version 2.x
import tensorflow as tf
#from tf.keras.models import Sequential
#from tf.keras.layers import Dense
import os
import io
tf.__version__
```
# Download Data
```
# Download the zip file
path_to_zip = tf.keras.utils.get_file("smsspamcollection.zip",
origin="https://archive.ic... | github_jupyter |
# 3D Partially coherent ODT forward simulation
This forward simulation is based on the SEAGLE paper ([here](https://ieeexplore.ieee.org/abstract/document/8074742)): <br>
```H.-Y. Liu, D. Liu, H. Mansour, P. T. Boufounos, L. Waller, and U. S. Kamilov, "SEAGLE: Sparsity-Driven Image Reconstruction Under Multiple Scatteri... | github_jupyter |
```
#default_exp fastai.dataloader
```
# DataLoader Errors
> Errors and exceptions for any step of the `DataLoader` process
This includes `after_item`, `after_batch`, and collating. Anything in relation to the `Datasets` or anything before the `DataLoader` process can be found in `fastdebug.fastai.dataset`
```
#expo... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(5)
y = x
t = x
fig, (ax1, ax2) = plt.subplots(1, 2)
ax1.scatter(x, y, c=t, cmap='viridis')
ax2.scatter(x, y, c=t, cmap='viridis_r')
color = "red"
plt.scatter(x, y, c=color)
sequence_of_colors = ["red", "orange", "yellow", "green", "blue","red", "ora... | github_jupyter |
```
# ==============================================================================
# Copyright 2021 Google LLC. This software is provided as-is, without warranty
# or representation for any use or purpose. Your use of it is subject to your
# agreement with Google.
# ===================================================... | github_jupyter |
# Hertzian conatct 1
## Assumptions
When two objects are brought into contact they intially touch along a line or at a single point. If any load is transmitted throught the contact the point or line grows to an area. The size of this area, the pressure distribtion inside it and the resulting stresses in each solid req... | github_jupyter |
```
import matplotlib.pyplot as plt
import numpy
from numpy import genfromtxt
import csv
import pandas as pd
from operator import itemgetter
from datetime import*
from openpyxl import load_workbook,Workbook
from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font
import openpyxl
from win32com ... | github_jupyter |
```
import json
import requests
import numpy as np
import pandas as pd
import pandas as pd
import requests
from requests.auth import HTTPBasicAuth
USERNAME = 'damminhtien'
PASSWORD = '**********'
TARGET_USER = 'damminhtien'
authentication = HTTPBasicAuth(USERNAME, PASSWORD)
import uuid
from IPython.display import dis... | github_jupyter |
# Missing Data
Missing values are a common problem within datasets. Data can be missing for a number of reasons, including tool/sensor failure, data vintage, telemetry issues, stick and pull, and omissing by choice.
There are a number of tools we can use to identify missing data, some of these methods include:
- Pa... | github_jupyter |
# Applying Chords to 2D and 3D Images
## Importing packages
```
import time
import porespy as ps
ps.visualization.set_mpl_style()
```
Import the usual packages from the Scipy ecosystem:
```
import scipy as sp
import scipy.ndimage as spim
import matplotlib.pyplot as plt
```
## Demonstration on 2D Image
Start by cre... | github_jupyter |
# Exercise 6
```
# Importing libs
import cv2
import numpy as np
import matplotlib.pyplot as plt
apple = cv2.imread('images/apple.jpg')
apple = cv2.cvtColor(apple, cv2.COLOR_BGR2RGB)
apple = cv2.resize(apple, (512,512))
orange = cv2.imread('images/orange.jpg')
orange = cv2.cvtColor(orange, cv2.COLOR_BGR2RGB)
orange = ... | github_jupyter |
# Offline analysis of a [mindaffectBCI](https://github.com/mindaffect) savefile
So you have successfully run a BCI experiment and want to have a closer look at the data, and try different analysis settings?
Or you have a BCI experiment file from the internet, e.g. MOABB, and want to try it with the mindaffectBCI an... | github_jupyter |
<div class="alert alert-block alert-info" style="margin-top: 20px">
<a href="https://cocl.us/corsera_da0101en_notebook_top">
<img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DA0101EN/Images/TopAd.png" width="750" align="center">
</a>
</div>
<a href="https://ww... | github_jupyter |
```
import cv2
cap = cv2.VideoCapture(0)
car_model=cv2.CascadeClassifier('cars.xml')
```
# TO DETECT CAR ON LIVE VIDEO OR PHOTO.....
```
while True:
ret,frame=cap.read()
cars=car_model.detectMultiScale(frame)
gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
for(x,y,w,h) in cars:
cv2.rectangle(fram... | github_jupyter |
<h1>datetime library</h1>
<li>Time is linear
<li>progresses as a straightline trajectory from the big bag
<li>to now and into the future
<li>日期库官方说明 https://docs.python.org/3.5/library/datetime.html
<h3>Reasoning about time is important in data analysis</h3>
<li>Analyzing financial timeseries data
<li>Looking at comm... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Algorithms/CloudMasking/landsat457_surface_reflectance.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
... | github_jupyter |
```
%%pyspark
df = spark.read.load('abfss://capture@splacceler5lmevhdeon4ym.dfs.core.windows.net/SeattlePublicLibrary/Library_Collection_Inventory.csv', format='csv'
## If header exists uncomment line below
, header=True
)
display(df.limit(10))
%%pyspark
# Show Schema
df.printSchema()
%%pyspark
from pyspark.sql i... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.