code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
```
import sys
import pandas as pd
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
sys.path.append('../Scripts')
from Data_Processing import DataProcessing
from tensorflow import keras
from keras.callbacks import ModelCheckpoint
from keras.models import load_model
from keras import back... | github_jupyter |
# Amazon Fine Food Reviews Analysis
Data Source: https://www.kaggle.com/snap/amazon-fine-food-reviews <br>
EDA: https://nycdatascience.com/blog/student-works/amazon-fine-foods-visualization/
The Amazon Fine Food Reviews dataset consists of reviews of fine foods from Amazon.<br>
Number of reviews: 568,454<br>
Numb... | github_jupyter |
# Conditional statements - part 1
## Motivation
All the previous programs are based on a pure sequence of statements. After the start of the program the statements are
executed step by step and the program ends afterwards. However, it is often necessary that parts of a program are
only executed under certain conditio... | github_jupyter |
<a href="https://colab.research.google.com/github/microprediction/microblog/blob/main/Election_in_the_run_with_correlation.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Greetings!
You might be here because you think
* Betting markets are f... | github_jupyter |
# Using a random forest for demographic model selection
In Schrider and Kern (2017) we give a toy example of demographic model selection via supervised machine learning in Figure Box 1. Following a discussion on twitter, Vince Buffalo had the great idea of our providing a simple example of supervised ML in population g... | github_jupyter |
## This notebook will help you train a vanilla Point-Cloud AE with the basic architecture we used in our paper.
(it assumes latent_3d_points is in the PYTHONPATH and the structural losses have been compiled)
```
import os.path as osp
from latent_3d_points.src.ae_templates import mlp_architecture_ala_iclr_18, defa... | github_jupyter |
## Figs for the measurement force paper
```
from scipy.io import loadmat
from scipy.optimize import curve_fit
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from numpy import trapz
def cm2inch(value):
return value/2.54
#axes.xaxis.set_tick_param... | github_jupyter |
#### Copyright 2017 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 writin... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import interpn
import os
import config
import utils
# Read measured profiles
measuredDoseFiles10 = ['./Measured/Method3/PDD1_10x10.dat','./Measured/Method3/PDD2_10x10.dat',
'./Measured/Method3/PROF1_10x10_14mm.dat','.... | github_jupyter |


```
import torch
import random
import numpy as np
random.seed(0)
np.random.seed(0)
torch.manual_seed(0)
torch.cuda.manual_seed(0)
torch.backends.cudnn... | github_jupyter |
```
import os
import pandas as pd
from newsapi import NewsApiClient
%matplotlib inline
from nltk.sentiment.vader import SentimentIntensityAnalyzer
analyzer = SentimentIntensityAnalyzer()
```
# News Headlines Sentiment
Use the news api to pull the latest news articles for bitcoin and ethereum and create a DataFrame of... | github_jupyter |
```
import torch
import torchvision
import torchvision.transforms as transforms
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform)
trainloader = ... | github_jupyter |
```
import numpy as np
import theano
import theano.tensor as T
import lasagne
import os
#thanks @keskarnitish
```
# Agenda
В предыдущем семинаре вы создали (или ещё создаёте - тогда марш доделывать!) {вставьте имя монстра}, который не по наслышке понял, что люди - негодяи и подлецы, которым неведом закон и справедлив... | github_jupyter |
*Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: A Practical Guide with Applications in Python" by [Sebastian Raschka](https://sebastianraschka.com). All code examples are released under the [MIT license](https://github.com/rasbt/deep-learning-book/blob/master/LICEN... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import sklearn
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
#from viz import viz
from bokeh.plotting import figure, show, output_notebook, output_file, save
#from functions import ... | github_jupyter |
```
# Packages
from IPython.display import Image
import rasterio
from rasterio import windows
import skimage
import skimage.io as skio
import json
import skimage.draw
import os
import sys
import pathlib
import math
import itertools
from shutil import copy2
import functools
from skimage import exposure
import matplotlib... | github_jupyter |
# Import packages & Connect the database
```
# Install MYSQL client
pip install PyMySQL
import sklearn
print('The scikit-learn version is {}.'.format(sklearn.__version__))
%load_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import pandas as pd
import datetime as dt
# Connect to database
import p... | github_jupyter |
<a href="https://colab.research.google.com/github/dlmacedo/ml-dl-notebooks/blob/master/notebooks/machine-learning/RECOMMENDED_Principal_Component_Analysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# In Depth: Principal Component Analysis
In ... | github_jupyter |
**Experiment for obtaining 24 Hr prediction from Dense Model in rainymotion library**
Author: Divya S. Vidyadharan
File use: For predicting 24 Hr precipitation images with **3 hr lead time.**
Date Created: 19-03-21
Last Updated: 20-03-21
Python version: 3.8.2
```
import h5py
import numpy as np
import matplotlib
... | github_jupyter |
# **M**odel **U**ncertainty-based Data **Augment**ation (muAugment)
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" align="left" src="https://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png" /></a> | Mariana Alves | <a href="https://supaerodatascience.g... | github_jupyter |
# Adversarial Variational Optimization: PYTHIA Tuning
In this notebook Adversarial Variational Optimization (https://arxiv.org/abs/1707.07113) is applied to tuning parameters of a simplistic detector.
**Note: this notebook takes quite a long time to execute. It is recommended to run all cells at the beginning.**
**P... | github_jupyter |
# 1) Matplotlib Part 1
## 1) Functional method
```
import numpy as np
import matplotlib.pyplot as plt
from numpy.random import randint
x = np.linspace(0,10,20)
x
y = randint(0,50,20)
y
y = np.sort(y)
y
plt.plot(x,y, color='m', linestyle='--', marker='*', markersize=10, lw=1.5)
plt.xlabel('X axis')
plt.ylabel('Y axis'... | github_jupyter |
```
import gpflow
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import sys
sys.path.append('../')
from GPHetero import hetero_kernels, hetero_likelihoods, hetero_gpmc
from pyDOE import *
import os
from scipy.stats import norm
class Ex5Func(object):
def __init__(self, sigma=lambda x: 0.5):
... | github_jupyter |
<a href="https://colab.research.google.com/github/MadhabBarman/Epidemic-Control-Model/blob/master/SEIRD_ControlModel.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!git clone https://github.com/MadhabBarman/Epidemic-Control-Model.git
cd Epidemi... | github_jupyter |
# Archive data
The Wellcome archive sits in a collections management system called CALM, which follows a rough set of standards and guidelines for storing archival records called [ISAD(G)](https://en.wikipedia.org/wiki/ISAD(G). The archive is comprised of _collections_, each of which has a hierarchical set of series, s... | github_jupyter |
# TV Script Generation
In this project, you'll generate your own [Seinfeld](https://en.wikipedia.org/wiki/Seinfeld) TV scripts using RNNs. You'll be using part of the [Seinfeld dataset](https://www.kaggle.com/thec03u5/seinfeld-chronicles#scripts.csv) of scripts from 9 seasons. The Neural Network you'll build will ge... | github_jupyter |
<a href="https://colab.research.google.com/github/lakigigar/Caltech-CS155-2021/blob/main/psets/set1/set1_prob3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Problem 3
Use this notebook to write your code for problem 3 by filling in the sections... | github_jupyter |
<a href="https://colab.research.google.com/github/chrismarkella/Kaggle-access-from-Google-Colab/blob/master/Pipeline_multiple_imputers_and_models.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!apt-get -qq install tree
import os
import numpy a... | github_jupyter |
# Synthesis Calibration
This chapter explains how to calibrate interferometer data within the CASA task system. Calibration is the process of determining the net complex correction factors that must be applied to each visibility in order to make them as close as possible to what an idealized interferometer would mea... | github_jupyter |
In this tutorial you'll learn all about **histograms** and **density plots**.
# Set up the notebook
As always, we begin by setting up the coding environment. (_This code is hidden, but you can un-hide it by clicking on the "Code" button immediately below this text, on the right._)
```
#$HIDE$
import pandas as pd
im... | github_jupyter |
# IMPORTING THE LIBRARIES
```
import os
import pandas as pd
import pickle
import numpy as np
import seaborn as sns
from sklearn.datasets import load_files
from keras.utils import np_utils
import matplotlib.pyplot as plt
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
from keras.layers import Drop... | github_jupyter |
# WeatherPy
----
#### 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 time
import json
... | github_jupyter |
Here you have a collection of guided exercises for the first class on Python. <br>
The exercises are divided by topic, following the topics reviewed during the theory session, and for each topic you have some mandatory exercises, and other optional exercises, which you are invited to do if you still have time after the... | github_jupyter |
```
# Import that good good
import sys
import os
sys.path.append('/Users/kolbt/Desktop/ipython/diam_files')
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import math
from IPython.display import display
from collections import OrderedDict
pd.options.display.max_rows = 2
import matplotlib.colors... | github_jupyter |
# TensorFlow Neural Machine Translation on Cloud TPUs
This tutorial demonstrates how to translate text using a LSTM Network from one language to another (from English to German in this case). We will work with a dataset that contains pairs of English-German phrases. Given a sequence of words in English, we train a mod... | github_jupyter |
*Practical Data Science 19/20*
# Programming Assignment
In this programming assignment you need to apply your new `numpy`, `pandas` and `matplotlib` knowledge. You will need to do several [`groupby`](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.groupby.html)s and [`join`](https://pandas.pyda... | github_jupyter |
```
import numpy as np
import pandas as pd
import competition_helpers
from sklearn import tree
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.naive_bayes import GaussianNB
from sklearn.ensemble import VotingClassifier, RandomForestClassifier
from sklearn.metrics import accu... | github_jupyter |
# Demo Notebook for CPW Kappa Calculation
Let's start by importing Qiskit Metal:
```
import qiskit_metal as metal
from qiskit_metal import designs, draw
from qiskit_metal import MetalGUI, Dict, open_docs
```
Next, let's import the function "kappa_in" located in the file kappa_calculation.py. This function calculates... | github_jupyter |
```
# We tweak the style of this notebook a little bit to have centered plots.
from IPython.core.display import HTML
HTML("""
<style>
.output_png {
display: table-cell;
text-align: center;
vertical-align: middle;
}
</style>
""");
%matplotlib inline
import warnings
warnings.filterwarnings('ignore')
warning... | github_jupyter |
# Notebook Goal & Approach
## Goal
For each FERC 714 respondent that reports hourly demand as an electricity planning area, create a geometry representing the geographic area in which that electricity demand originated. Create a separate geometry for each year in which data is available.
## Approach
* Use the `eia_co... | github_jupyter |
<center>
<hr>
<h1>Python Crash Course</h1>
<h2>Master in Data Science - Sapienza University</h2>
<h2>Homework 2: Python Challenges</h2>
<h3>A.A. 2017/18</h3>
<h3>Tutor: Francesco Fabbri</h3>
<hr>
</center>

# Instructions
So guys, here we are! **Finally** you're facing ... | github_jupyter |
```
import numpy
import numpy as np
# import matplotlib
import matplotlib.pyplot as plt
# set the figure size for each figure in this tutorial
plt.rcParams["figure.figsize"] = (10,6)
```
## Lineplot
```
# 200 values from the interval <0,100>, equidistantly divided
x = np.linspace(0,100,200)
y = np.sin(x)
# a line ... | github_jupyter |
```
import numpy as np
import cv2
import matplotlib.pyplot as plt
from keras import models
import keras.backend as K
import tensorflow as tf
from sklearn.metrics import f1_score
import requests
import xmltodict
import json
plateCascade = cv2.CascadeClassifier('indian_license_plate.xml')
#detect the plate and return car... | github_jupyter |
```
# Datset source
# https://archive.ics.uci.edu/ml/datasets/Appliances+energy+prediction
# Problem statement: Predict the appliances energy use based on various features
# Python ≥3.5 is required
import sys
assert sys.version_info >= (3, 5)
# Scikit-Learn ≥0.20 is required
import sklearn
assert sklearn.__version__ >... | github_jupyter |
# Part 0: Mining the web
Perhaps the richest source of openly available data today is [the Web](http://www.computerhistory.org/revolution/networking/19/314)! In this lab, you'll explore some of the basic programming tools you need to scrape web data.
> **Note.** The Vocareum platform runs in a cloud-based environment... | github_jupyter |
# Main notebook for battery state estimation
```
import numpy as np
import pandas as pd
import scipy.io
import math
import os
import ntpath
import sys
import logging
import time
import sys
from importlib import reload
import plotly.graph_objects as go
import tensorflow as tf
from tensorflow import keras
from tensorf... | github_jupyter |
```
%matplotlib inline
"""
The data set in this example represents 1059 songs from various countries obtained
from the UCI Machine Learning library. Various features of the audio tracks have been
extracted, and each track has been tagged with the latitude and longitude of the capital
city of its country of origin. ... | github_jupyter |
```
import numpy as np
import pandas as pd
from pathlib import Path
%matplotlib inline
```
# Regression Analysis: Seasonal Effects with Sklearn Linear Regression
In this notebook, you will build a SKLearn linear regression model to predict Yen futures ("settle") returns with *lagged* Yen futures returns.
```
# Future... | github_jupyter |
# 酷我音樂
- 下載酷我音樂平台上電台的「專輯」音檔
# 載入套件
```
import re
import os
import time
import requests
from bs4 import BeautifulSoup
```
# 設定爬蟲參數
```
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36 Edg/88.0.705.63',
'Cookie': '... | github_jupyter |
```
%matplotlib inline
import json
import pylab
import copy
from pprint import pprint
import numpy as np
from lxml import etree
import matplotlib.colors
from pysurvey.plot import icolorbar, text, box
from pysurvey.plot import setup_sns as setup
import seaborn as sns
sns.set_style('white')
def make_cmap():
# from b... | github_jupyter |
```
import numpy as np
a = np.matrix([[1,2,3],[4,5,6]])
print(type(a))
print(a.T)
print(a.shape)
print(a.transpose())
class Dog:
pass # placeholder
my_dog = Dog() # must have ()!!
print(type(my_dog))
isinstance(my_dog,Dog)
```
## Class Attributes
In practice a dog as a color, breed, age, and other attributes, and ... | github_jupyter |
```
import cv2
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.models import Sequential, Model
from keras.layers import Flatten, Dense, Conv2D, MaxPooling2D, BatchNormalization, Cropping2D, Lambda, Activation, Dropout
from keras.optimizers import Adam
from keras.initializers import gl... | github_jupyter |
##### Copyright 2020 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0
# 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 writ... | github_jupyter |
# **Amazon Lookout for Equipment** - 익명화한 익스펜더 데이터셋에 대한 데모
*파트 5: 정기적인 추론 호출 스케줄링*
```
BUCKET = '<YOUR_BUCKET_NAME_HERE>'
PREFIX = 'data/scheduled_inference'
```
## 초기화
---
이 노트북에서는 데이터 폴더에 추론 디렉토리를 추가하게끔 저장소 구조를 갱신합니다.
```
/lookout-equipment-demo
|
+-- data/
| |
| +-- inference/
| | |
| | |-- input/
| ... | github_jupyter |
```
import open3d as o3d
import numpy as np
import os
import sys
# monkey patches visualization and provides helpers to load geometries
sys.path.append('..')
import open3d_tutorial as o3dtut
# change to True if you want to interact with the visualization windows
o3dtut.interactive = not "CI" in os.environ
```
# RGBD ... | github_jupyter |
```
import astrodash
import os
import astropy
import numpy as np
from astropy.table import Table
from astropy.table import Column
import glob
import matplotlib.pyplot as plt
import pandas as pd
from collections import Counter
from mpl_toolkits.mplot3d import Axes3D
sample_location = "/home/hallflower/sample/spectra/"
d... | github_jupyter |
# Apache Arrow
## 1 Compare performance of csv, Parquet and Arrow - 1 Change
```
import pyarrow.parquet as pq
import pyarrow as pa
import pandas as pd
import numpy as np
import os
import psutil
```
### 1.1 Load and prepare data One more change
```
## Read Palmer Station Penguin dataset from GitHub
df = pd.read_csv... | github_jupyter |
# Controlling accesss to attributes
* Following blocks are one possible implementation of vectors of `double`s.
* Here, member variable `new_name` is in `protected:` part.
* Member methods and subclass members can access this variable but from the outside of the class, we cannot access it.
* We call it **encapsulatio... | github_jupyter |
# Overview
- nb023 ベース
- nb034の結果を使う
# Const
```
NB = '035'
isSmallSet = False
if isSmallSet:
LENGTH = 7000
else:
LENGTH = 500_000
PATH_TRAIN = './../data/input/train_clean.csv'
PATH_TEST = './../data/input/test_clean.csv'
PATH_SMPLE_SUB = './../data/input/sample_submission.csv'
DIR_OUTPUT = './../data/outpu... | github_jupyter |
# Using Interrupts and asyncio for Buttons and Switches
This notebook provides a simple example for using asyncio I/O to interact asynchronously with multiple input devices. A task is created for each input device and coroutines used to process the results. To demonstrate, we recreate the flashing LEDs example in the ... | github_jupyter |
```
import os
import pandas as pd
import matplotlib.pyplot as plt
import sys
sys.path.append('../')
from default_constants import *
from ECE_mechanism.voltammogram_ECE_no_plot import CSV_ECE_ox
from plot_tools import extract_expe_like_CSV
from scipy.optimize import minimize
def plot_experimental_data(folder_name):
... | github_jupyter |
# Making Simple Plots
## Objectives
+ Learn how to make a simple 1D plot in Python.
+ Learn how to find the maximum/minimum of a function in Python.
We will use [Problem 4.B.2](https://youtu.be/w-IGNU2i3F8) of the lecturebook as a motivating example.
We find that the moment of the force $\vec{F}$ about point A is:
$$... | github_jupyter |
# VacationPy
----
#### Note
* Keep an eye on your API usage. Use https://developers.google.com/maps/reporting/gmp-reporting as reference for how to monitor your usage and billing.
* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think throug... | github_jupyter |
```
from IPython.core.display import HTML
def css_styling():
styles = open("./styles/custom.css", "r").read()
return HTML(styles)
css_styling()
```
### BEFORE YOU DO ANYTHING...
In the terminal:
1. Navigate to __inside__ your ILAS_Python repository.
2. __COMMIT__ any un-commited work on your personal computer.... | github_jupyter |
Prove that for integers $a,\;b,\;\dots$
(1) $(a, b) = 1, \; c | a, \; d | a \implies (c, d) = 1$
Suppose $(c, d) = e > 1$. Then $e | c$ and $c | a$ implies $e | a$; similarly $e | b$ so $(a, b) > 1$, a
contradiction, and therefore $(c, d) = 1$. $\;\;\;\boxdot$
(2) $(a, b) = (a, c) = 1 \implies (a, bc) = 1$
(3) $... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Plot-Validation-and-Train-loss" data-toc-modified-id="Plot-Validation-and-Train-loss-1"><span class="toc-item-num">1 </span>Plot Validation and Train loss</a></span></li><li><span><a href="#Extra... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```
# `np.tile` vs. `np.repeat`
```
np.tile([1, 2, 3], reps=2)
np.repeat([1, 2, 3], 2)
```
### multidimensional
```
np.tile(np.repeat([1, 2, 3, 4], 2), 3)
d = {'b': 12}
dict({'a': 2}, **d)
a = np.arange(4).reshape(2, -1)
np.tile(a, (2, 3))
a... | github_jupyter |
# Welcome!
Below, we will learn to implement and train a policy to play atari-pong, using only the pixels as input. We will use convolutional neural nets, multiprocessing, and pytorch to implement and train our policy. Let's get started!
```
# install package for displaying animation
!pip install JSAnimation
# custom... | github_jupyter |
```
%matplotlib inline
```
# Optimization Opt 1 parameter
```
def run(Plot, Save):
return
import numpy as np
from PyMieSim import Material
from PyMieSim.Scatterer import Sphere
from PyMieSim.Detector import Photodiode, LPmode
from PyMieSim.Source import PlaneWave
from Py... | github_jupyter |
# 6. Hidden Markov Models with Theano and TensorFlow
In the last section we went over the training and prediction procedures of Hidden Markov Models. This was all done using only vanilla numpy the Expectation Maximization algorithm. I now want to introduce how both `Theano` and `Tensorflow` can be utilized to accomplis... | github_jupyter |
```
# use python eval sometimes. great trickdefining a class and operator overloading
import aoc
f = open('input.txt')
lines = [line.rstrip('\n') for line in f]
lines[0]
# part 1
def evaluate(line):
ans = 0
firstop = None
operator = None
wait = 0
for i, ch in enumerate(line):
if wait > 0: # ... | github_jupyter |
## Automagically making a table of all protein-protein interactions for two structures
If two structures use the same or essentially the same, you can use Python to make a table of all the pairs of the protein-protein interactions by the two structures that can be used as input for the pipeline described in an earlier... | github_jupyter |
# Car Decor Sales Forecasting - Perfumes
###### Importing Libraries
```
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.metrics import mean_squared_error
from math import sqrt
# Connecting Python to MySQL for fetching data
import mysql.co... | github_jupyter |
```
import os
from IPython.core.display import Image, display
```
## Deliverables
### Tony
* Clustering -- learn about clustering. Make a LaTeX (or Markdown) file explaining what K-means, K-medeods, Spectral, Louvain do. Explain basics of implementation, and include a pro/con table discussing what each does well/poor... | github_jupyter |
<h1 align="center"> Battle of the Neighbourhoods - Toronto </h1>
Author: Ganesh Chunne
This notebook contains Questions 1, 2 & 3 of the Assignment. They have been segregated by Section headers
```
import pandas as pd
```
# Question 1
## Importing Data
```
import requests
url = "https://en.wikipedia.org/wiki/List... | github_jupyter |
Time Series
- collecting dxata at regular intervales
**ADDITIVE MODEL**
- represent a TS as a combinatino fo patterns at diffferent scales.
- Decompose pieces
## QUANDL FINANCIAL LIBRARY
- https://www.quandl.com/tools/python
- https://github.com/quandl/quandl-python
```
#!pip install quandl
import quandl
import pan... | github_jupyter |
# Code Transfer Test
The code transfer test is designed to test your coding skills that is learnt during the lecture training. The allotted time for the subsequent problem set is approximately 30 minutes. You are allowed to refer to Jupyter notebook throughout the test. Good luck!
Jupyter notebook resource:
Timer e... | github_jupyter |
# Creating Provenance an Example Using a Python Notebook
```
import prov, requests, pandas as pd, io, git, datetime, urllib
from prov.model import ProvDocument
```
## Initialising a Provenance Document
First we use the prov library to create a provenance and initialise it with some relevant namespaces that can be us... | github_jupyter |
# Cython in Jupyter notebooks
To use cython in a Jupyter notebook, the extension has to be loaded.
```
%load_ext cython
```
## Pure Python
To illustrate the performance difference between a pure Python function and a cython implementation, consider a function that computes the list of the first $k_{\rm max}$ prime ... | github_jupyter |
```
!pip install plotly
```
<a href="https://plotly.com/python/" target="_blank">Plotly's</a> Python graphing library makes interactive, publication-quality graphs. Examples of how to make line plots, scatter plots, area charts, bar charts, error bars, box plots, histograms, heatmaps, subplots, multiple-axes, polar ch... | github_jupyter |
# Umami notebooks
Welcome to the umami notebooks. This page provides links to notebooks that provide an introduction to umami and its use. We recommend that you look at them in the following order.
First, look at two notebooks designed to introduce you to the core classes and methods of umami.
* [Part 1: Introduc... | github_jupyter |
### Mit kellene tudni?
#### 1. Megfogalmazni egy programozási problémát <!-- .element: class="fragment" -->
#### 1. Számításelmélet értelmét elmagyarázni <!-- .element: class="fragment" -->
#### 1. Lebontani egy komplex problémát egyszerűbbekre <!-- .element: class="fragment" -->
#### 1. Megérteni egy leírt progr... | github_jupyter |
# Análise do eleitorado brasileiro
Fonte -> http://www.tse.jus.br/eleicoes/estatisticas/estatisticas-eleitorais
```
# importando as bibliotecas
import pandas as pd
# Carregando o arquivo csv
df = pd.read_csv('eleitorado_municipio_2020.csv', encoding='latin1', sep=';')
df.head().T
# Tamanho do arquivo
df.info()
# As ... | github_jupyter |
# Módulo 2: Scraping con Selenium
## LATAM Airlines
<a href="https://www.latam.com/es_ar/"><img src="https://i.pinimg.com/originals/dd/52/74/dd5274702d1382d696caeb6e0f6980c5.png" width="420"></img></a>
<br>
Vamos a scrapear el sitio de Latam para averiguar datos de vuelos en funcion el origen y destino, fecha y cabin... | github_jupyter |
## RIHAD VARIAWA, Data Scientist - Who has fun LEARNING, EXPLORING & GROWING
<h1>2D <code>Numpy</code> in Python</h1>
<p><strong>Welcome!</strong> This notebook will teach you about using <code>Numpy</code> in the Python Programming Language. By the end of this lab, you'll know what <code>Numpy</code> is and the <code... | github_jupyter |
# Master Notebook: Bosques aleatorios
Como ya vímos en scikit-learn gran parte de codigo es reciclable. Particularmente, leyendo variables y preparando los datos es lo mismo, independientemente del clasificador que usamos.
## Leyendo datos
Para que no esta tan aburrido (también para mi) esta vez nos vamos a escribir... | github_jupyter |
Initialize estimator class
```
from __future__ import annotations
from typing import NoReturn
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import RocCurveDisplay, accuracy_score
from IMLearn.base import BaseEstimator
import re
from copy import copy... | github_jupyter |
```
# Let's keep our notebook clean, so it's a little more readable!
import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
```
# Machine learning to predict age from rs-fmri
The goal is to extract data from several rs-fmri images, and use that data as features in a machine learning model. We will integ... | github_jupyter |
<!--NAVIGATION-->
< [Errors and Exceptions](09-Errors-and-Exceptions.ipynb) | [Contents](Index.ipynb) | [List Comprehensions](11-List-Comprehensions.ipynb) >
# Iterators
Often an important piece of data analysis is repeating a similar calculation, over and over, in an automated fashion.
For example, you may have a ta... | github_jupyter |
###### Content under Creative Commons Attribution license CC-BY 4.0, code under MIT license (c)2014 L.A. Barba, G.F. Forsyth, C.D. Cooper.
# Spreading out
We're back! This is the fourth notebook of _Spreading out: parabolic PDEs,_ Module 4 of the course [**"Practical Numerical Methods with Python"**](https://openedx... | github_jupyter |
# DATA 512: A1 Data Curation Assignment
By: Megan Nalani Chun
## Step 1: Gathering the data <br>
Gather Wikipedia traffic from Jan 1, 2008 - August 30, 2020 <br>
- Legacy Pagecounts API provides desktop and mobile traffic data from Dec. 2007 - July 2016 <br>
- Pageviews API provides desktop, mobile web, and mobile app... | github_jupyter |
```
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import math
import os
import random
import pickle
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import RandomForestRegressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.ensem... | github_jupyter |
First import the "datavis" module
```
import sys
sys.path.append('..')
import numpy as np
import datavis
import vectorized_datavis
def test_se_to_sd():
"""
Test that the value returned is a float value
"""
sdev = datavis.se_to_sd(0.5, 1000)
assert isinstance(sdev, float),\
"Returned data type ... | github_jupyter |
# IDS Instruction: Regression
(Lisa Mannel)
## Simple linear regression
First we import the packages necessary fo this instruction:
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error, mean_absolut... | github_jupyter |
```
import scraping_class
logfile = 'log.txt'## name your log file.
connector = scraping_class.Connector(logfile)
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm_notebook
import pandas as pd
import numpy as np
import html5lib
import sys
import pickle
from tqdm import tqdm_notebook
import seaborn as ... | github_jupyter |
<a href="https://colab.research.google.com/github/bhadreshpsavani/ExploringSentimentalAnalysis/blob/main/SentimentalAnalysisWithGPTNeo.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
## Step1. Import and Load Data
```
!pip install -q pip install gi... | github_jupyter |
## parameters
```
CLUSTER_ALGO = 'KMedoids'
C_SHAPE ='circle'
#C_SHAPE ='CIRCLE'
#C_SHAPE ='ellipse'
#N_CLUSTERS = [50,300, 1000]
N_CLUSTERS = [3]
CLUSTERS_STD = 0.3
N_P_CLUSTERS = [3, 30, 300, 3000]
N_CLUSTERS_S = N_CLUSTERS[0]
INNER_FOLDS = 3
OUTER_FOLDS = 3
```
## includes
```
%matplotlib inline
import matplotli... | github_jupyter |
```
from collections import OrderedDict
from collections import namedtuple
import numpy as np
from scipy import stats
# R precision
def r_precision(targets, predictions, max_n_predictions=500):
# Assumes predictions are sorted by relevance
# First, cap the number of predictions
predictions = predictions[... | github_jupyter |
# [NTDS'19] assignment 1: network science
[ntds'19]: https://github.com/mdeff/ntds_2019
[Eda Bayram](https://lts4.epfl.ch/bayram), [EPFL LTS4](https://lts4.epfl.ch) and
[Nikolaos Karalias](https://people.epfl.ch/nikolaos.karalias), [EPFL LTS2](https://lts2.epfl.ch).
## Students
* Team: `<5>`
* `<Alice Bizeul, Gaia ... | github_jupyter |
# Implementing a CGAN for the Iris data set to generate synthetic data
### Import necessary modules and packages
```
import os
while os.path.basename(os.getcwd()) != 'Synthetic_Data_GAN_Capstone':
os.chdir('..')
from utils.utils import *
safe_mkdir('experiments')
from utils.data_loading import load_raw_dataset
imp... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.