code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# CA5 Phase 2
## Mohammad Ali Zare
### 810197626
In this assignment we must classify Xray scans of patients and tell if they're **Normal**, or they have **Covid19**/**Pneuma**.
We do this using neural networks and will try different parameters to see how the performance of the model would change.
```
import numpy a... | github_jupyter |
```
# Quick and dirty test Auditory perception whole docs vs. other categories
```
### Positive corpus from all Auditory abstracts
- 146 documents in batch_05_AP_pmids (most are actually AP)
### Compare Auditory perception to corpus for other topics
Decreasing distance:
- 1000 disease documents
- 1000 arousal documen... | github_jupyter |
## 1. KMeans vs GMM
在第一个例子中,我们将生成一个高斯数据集,并尝试对其进行聚类,看看其聚类结果是否与数据集的原始标签相匹配。
我们可以使用 sklearn 的 [make_blobs] (http://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_blobs.html) 函数来创建高斯 blobs 的数据集:
```
import numpy as np
import matplotlib.pyplot as plt
from sklearn import cluster, datasets, mixture
%matp... | github_jupyter |
# AUTOMATIC DIFFERENTIATION WITH [TORCH.AUTOGRAD](https://pytorch.org/tutorials/beginner/basics/autogradqs_tutorial.html#automatic-differentiation-with-torch-autograd)
When training neural networks, the most frequently used algorithm is **back propagation**. In this algorithm, parameters (model weights) are adjusted a... | github_jupyter |
## Create a classifier to predict the wine color from wine quality attributes using this dataset: http://archive.ics.uci.edu/ml/datasets/Wine+Quality
## The data is in the database we've been using
+ host='training.c1erymiua9dx.us-east-1.rds.amazonaws.com'
+ database='training'
+ port=5432
+ user='dot_student'
+ passw... | github_jupyter |
** Build Adjacency Matrix **
**Note:** You must put the generated JSON file into a zip file. We probably should code this in too.
```
import sqlite3
import json
# Progress Bar I found on the internet.
# https://github.com/alexanderkuk/log-progress
from progress_bar import log_progress
PLOS_PMC_DB = 'sqlite_data/data... | github_jupyter |
# Introduction to Digital Image Treatment
OpenCV is one of the most popular libraries for DIT, it was originally wrote in C but since some time ago we can find Python bindings that let us to use with the simplied pythonic synthaxis.
Let's begin to play some with the library
```
# Import modules
import cv2
import num... | github_jupyter |
<a href="https://colab.research.google.com/github/skredenmathias/DS-Unit-2-Applied-Modeling/blob/master/module4/assignment_applied_modeling_1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Lambda School Data Science
*Unit 2, Sprint 3, Module 1*
-... | github_jupyter |
<a href="https://colab.research.google.com/github/chrisart10/DeepLearning.ai-Summary/blob/master/pipeline3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Definir dimension de imagen
```
input_shape =300
```
# Importar modelos mediante tranfer l... | github_jupyter |
<div class="alert alert-block alert-info" style="margin-top: 20px">
<a href="http://cocl.us/topNotebooksPython101Coursera">
<img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/Ad/TopAd.png" width="750" align="center">
</a>
</div>
<a href="https://cogniti... | github_jupyter |
# KNN
Importing required python modules
---------------------------------
```
import matplotlib.pyplot as plt
from sklearn.neighbors import KNeighborsClassifier
from sklearn.cross_validation import train_test_split
from sklearn import metrics
from sklearn.preprocessing import normalize,scale
from sklearn.cross_valid... | github_jupyter |
# Jupyter Superpower - Extend SQL analysis with Python
> Making collboration with Notebook possible and share perfect SQL analysis with Notebook.
- toc: true
- badges: true
- comments: true
- author: noklam
- categories: ["python", "reviewnb", "sql"]
- hide: false
- canonical_url: https://blog.reviewnb.com/jupyter-s... | github_jupyter |
<img src="../Images/Level1Beginner.png" alt="Beginner" width="128" height="128" align="right">
## Tuplas en Python
Una tupla es una secuencia **inmutable** de elementos de cualquier tipo.
Se comporta como una lista en la que no se puede modificar los elementos individuales.
La discusión sobre listas y tuplas tiene ... | github_jupyter |
```
#import pandas
import pandas as pd
import os
#Load files
School_info_path=os.path.join("Resources","schools_complete.csv")
Student_info_path=os.path.join("Resources","students_complete.csv")
#Read school files
school_data_df=pd.read_csv(School_info_path)
#Read the student info
student_data_df=pd.read_csv(Student_in... | github_jupyter |
# 函数
- 函数可以用来定义可重复代码,组织和简化
- 一般来说一个函数在实际开发中为一个小功能
- 一个类为一个大功能
- 同样函数的长度不要超过一屏
Python中的所有函数实际上都是有返回值(return None),
如果你没有设置return,那么Python将不显示None.
如果你设置return,那么将返回出return这个值.
```
def HJN():
print('Hello')
return 1000
b=HJN()
print(b)
HJN
def panduan(number):
if number % 2 == 0:
print('O')
e... | github_jupyter |
<h2>Segmenting and Clustering Neighbourhoods in Toronto</h2>
The project includes scraping the Wikipedia page for the postal codes of Canada and then process and clean the data for the clustering. The clustering is carried out by K Means and the clusters are plotted using the Folium Library. The Boroughs containing th... | github_jupyter |
```
#Import Required Packages
import requests
import time
import schedule
import os
import json
import newspaper
from bs4 import BeautifulSoup
from datetime import datetime
from newspaper import fulltext
import newspaper
import pandas as pd
import numpy as np
import pickle
#Set Today's Date
#dates = [datetime.today().s... | github_jupyter |
Universidade Federal do Rio Grande do Sul (UFRGS)
Programa de Pós-Graduação em Engenharia Civil (PPGEC)
# PEC00144: Experimental Methods in Civil Engineering
### Reading the serial port of an Arduino device
---
_Prof. Marcelo M. Rocha, Dr.techn._ [(ORCID)](https://orcid.org/0000-0001-5640-1020)
_Porto Aleg... | github_jupyter |
```
%reload_ext autoreload
%autoreload 2
%matplotlib inline
from fastai.text import *
path = Path('./WikiTextTR')
path.ls()
LANG_FILENAMES = [str(f) for f in path.rglob("*/*")]
print(len(LANG_FILENAMES))
print(LANG_FILENAMES[:5])
LANG_TEXT = []
for i in LANG_FILENAMES:
try:
for line in open(i, encoding="utf... | github_jupyter |
# Computational Assignment 1
**Assigned Monday, 9-9-19.**, **Due Thursday, 9-12-19.**
Most of the problems we encounter in computational chemistry are multidimensional. This means that we need to be able to work with vectors and matrices in our code. Even when we consider a 1-dimensional function, we still need to c... | github_jupyter |

import time
import concurrent.futures as cf
import warn... | github_jupyter |
# M2: Basic Graphing Assignment - Denis Pelevin
```
# Import matplotlib and Pandas
import matplotlib.pyplot as plt
import pandas as pd
# Enable in-cell graphs
%matplotlib inline
# Read-in the input files and tore in Data frames
df_opiods = pd.read_csv('OpiodsVA.csv')
df_pres = pd.read_csv('presidents.csv')
df_cars =... | github_jupyter |
# Data Analysis
# FINM September Launch
# Homework Solution 5
## Imports
```
import pandas as pd
import numpy as np
import statsmodels.api as sm
from sklearn.linear_model import LinearRegression
from sklearn.decomposition import PCA
from sklearn.cross_decomposition import PLSRegression
from numpy.linalg import svd
im... | github_jupyter |
# Training and Evaluating ACGAN Model
*by Marvin Bertin*
<img src="../../images/keras-tensorflow-logo.jpg" width="400">
# Imports
```
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from collections import default... | github_jupyter |
# 自动微分
:label:`sec_autograd`
正如我们在 :numref:`sec_calculus`中所说的那样,求导是几乎所有深度学习优化算法的关键步骤。
虽然求导的计算很简单,只需要一些基本的微积分。
但对于复杂的模型,手工进行更新是一件很痛苦的事情(而且经常容易出错)。
深度学习框架通过自动计算导数,即*自动微分*(automatic differentiation)来加快求导。
实际中,根据我们设计的模型,系统会构建一个*计算图*(computational graph),
来跟踪计算是哪些数据通过哪些操作组合起来产生输出。
自动微分使系统能够随后反向传播梯度。
这里,*反向传播*(backpropagat... | github_jupyter |
# Rossman data preparation
To illustrate the techniques we need to apply before feeding all the data to a Deep Learning model, we are going to take the example of the [Rossmann sales Kaggle competition](https://www.kaggle.com/c/rossmann-store-sales). Given a wide range of information about a store, we are going to try... | github_jupyter |
### Introduction
I am testing the idea of using the juyter notebook as my script so the comments are verbose. Hopefully this helps synchronize the notebook content with the video. Comments on this approach are welcome.
More content like this can be found at [robotsquirrelproductions.com](https://robotsquirrelproducti... | github_jupyter |
<style>div.container { width: 100% }</style>
<img style="float:left; vertical-align:text-bottom;" height="65" width="172" src="../assets/holoviz-logo-unstacked.svg" />
<div style="float:right; vertical-align:text-bottom;"><h2>SciPy 2020 Tutorial Index</h2></div>
<div class="alert alert-warning" role="alert"> <strong>... | github_jupyter |
```
print('Materialisation Data Test')
import os
import compas
from compas.datastructures import Mesh, mesh_bounding_box_xy
from compas.geometry import Vector, Frame, Scale
HERE = os.getcwd()
FILE_I = os.path.join(HERE, 'blocks and ribs_RHINO', 'sessions', 'bm_vertical_equilibrium', 'simple_tripod.rv2')
FILE_O1 = os.... | github_jupyter |
* [1.0 - Introduction](#1.0---Introduction)
- [1.1 - Library imports and loading the data from SQL to pandas](#1.1---Library-imports-and-loading-the-data-from-SQL-to-pandas)
* [2.0 - Data Cleaning](#2.0---Data-Cleaning)
- [2.1 - Pre-cleaning, investigating data types](#2.1---Pre-cleaning,-investigatin... | github_jupyter |
# Lung damage - linear regression model
```
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
from sklearn import linear_model
from sklearn.model_selection import train_test_split
import seaborn as sns
import matplotlib.pyplot as plt
from urls import lung_damage_url
#CSV are read i... | github_jupyter |
```
import tensorflow as tf
import keras
import keras.backend as K
from sklearn.utils import shuffle
from sklearn.metrics import classification_report, confusion_matrix, accuracy_score, f1_score
from collections import Counter
from keras import regularizers
from keras.models import Sequential, Model, load_model, mo... | github_jupyter |
# DAT257x: Reinforcement Learning Explained
## Lab 2: Bandits
### Exercise 2.3: UCB
```
# import numpy as np
# import sys
# if "../" not in sys.path:
# sys.path.append("../")
# from lib.envs.bandit import BanditEnv
# from lib.simulation import Experiment
# #Policy interface
# class Policy:
# #num_actions:... | github_jupyter |
<figure>
<IMG SRC="https://raw.githubusercontent.com/mbakker7/exploratory_computing_with_python/master/tudelft_logo.png" WIDTH=250 ALIGN="right">
</figure>
# Exploratory Computing with Python
*Developed by Mark Bakker*
## Notebook 9: Discrete random variables
In this Notebook you learn how to deal with discrete ran... | github_jupyter |
Lambda School Data Science
*Unit 2, Sprint 3, Module 3*
---
# Permutation & Boosting
- Get **permutation importances** for model interpretation and feature selection
- Use xgboost for **gradient boosting**
### Setup
Run the code cell below. You can work locally (follow the [local setup instructions](https://lambd... | github_jupyter |
# Partial Correlation
The purpose of this notebook is to understand how to compute the [partial correlation](https://en.wikipedia.org/wiki/Partial_correlation) between two variables, $X$ and $Y$, given a third $Z$. In particular, these variables are assumed to be guassians (or, in general, multivariate gaussians).
W... | github_jupyter |
# Starbucks Capstone Challenge
### Introduction
This data set contains simulated data that mimics customer behavior on the Starbucks rewards mobile app. Once every few days, Starbucks sends out an offer to users of the mobile app. An offer can be merely an advertisement for a drink or an actual offer such as a discou... | github_jupyter |
## Recommender System Algorithm
### Objective
We want to help consumers find attorneys. To surface attorneys to consumers, sales consultants often have to help attorneys describe their areas of practice (areas like Criminal Defense, Business or Personal Injury).
To expand their practices, attorneys can branch into r... | github_jupyter |
# Import bibilotek
```
import pandas as pd
import numpy as np
import xgboost as xgb
from sklearn.tree import DecisionTreeRegressor
from sklearn.model_selection import cross_val_score, KFold
from sklearn.metrics import mean_absolute_error
pip install --upgrade tables
```
# Odczyt danych z pliku h5
```
df_train = pd... | github_jupyter |
```
print('hello')
for number in [1,2,3]:
print(number)
print('1+3 is {}'.format(1+3))
!pip install psycopg2
import pandas
import psycopg2
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
host=config['myaws']['host']
db=config['myaws']['db']
user=config['myaws']['user']
pwd = conf... | github_jupyter |
# Analysis of Chest X-Ray images
Neural networks have revolutionised image processing in several different domains. Among these is the field of medical imaging. In the following notebook, we will get some hands-on experience in working with Chest X-Ray (CXR) images.
The objective of this exercise is to identify image... | github_jupyter |
# Gallery of examples

Here you can browse a gallery of examples using EinsteinPy in the form of Jupyter notebooks.
## [Analyzing Earth using EinsteinPy!](docs/source/examples/Analyzing%20Earth%20using%20EinsteinPy!.ipynb)
[
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import ... | github_jupyter |
# Sentiment Classification & How To "Frame Problems" for a Neural Network
by Andrew Trask
- **Twitter**: @iamtrask
- **Blog**: http://iamtrask.github.io
### What You Should Already Know
- neural networks, forward and back-propagation
- stochastic gradient descent
- mean squared error
- and train/test splits
### Wh... | github_jupyter |
<p style="border: 1px solid #e7692c; border-left: 15px solid #e7692c; padding: 10px; text-align:justify;">
<strong style="color: #e7692c">Tip.</strong> <a style="color: #000000;" href="https://nbviewer.jupyter.org/github/PacktPublishing/Hands-On-Computer-Vision-with-Tensorflow/blob/master/ch4/ch4_nb5_explore_imagen... | github_jupyter |
# Few-Shot Learning With Prototypical Networks
```
import torch
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from matplotlib import pyplot as plt
import cv2
from tensorboardX import SummaryWriter
from torch import optim
from tqdm import tqdm
import multip... | github_jupyter |
<table>
<tr><td><img style="height: 150px;" src="images/geo_hydro1.jpg"></td>
<td bgcolor="#FFFFFF">
<p style="font-size: xx-large; font-weight: 900; line-height: 100%">AG Dynamics of the Earth</p>
<p style="font-size: large; color: rgba(0,0,0,0.5);">Jupyter notebooks</p>
<p style="font-size: large; color: ... | github_jupyter |
# 1. User Reviews via Steam API (https://partner.steamgames.com/doc/store/getreviews)
```
# import packages
import os
import sys
import time
import json
import numpy as np
import urllib.parse
import urllib.request
from tqdm import tqdm
import plotly.express as px
from datetime import datetime
from googletrans import T... | github_jupyter |
# Benchmarking the Permanent
This tutorial shows how to use the permanent function using The Walrus, which calculates the permanent using Ryser's algorithm
### The Permanent
The permanent of an $n$-by-$n$ matrix A = $a_{i,j}$ is defined as
$\text{perm}(A)=\sum_{\sigma\in S_n}\prod_{i=1}^n a_{i,\sigma(i)}.$
The sum ... | 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 |
# BUSINESS UNDERSTANDING
# DATA UNDERSTANDING
### Collecting The Sonic Features
Collecting implicitly labeled songs from playlists such as 'top 100 country songs'. Experiment can be rerun with different genres.
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import it... | github_jupyter |
```
from keras import applications
# python image_scraper.py "yellow labrador retriever" --count 500 --label labrador
from keras.preprocessing.image import ImageDataGenerator
from keras_tqdm import TQDMNotebookCallback
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import (... | github_jupyter |
```
import os
path_parent = os.path.dirname(os.getcwd())
os.chdir(path_parent)
from data_utils.utils import get_X_y_from_data, data_dict_from_df_tables
from ggmodel_dev.models.landuse.BE2 import model_dictionnary
import pandas as pd
import numpy as np
from ggmodel_dev.graphmodel import GraphModel, concatenate_graph_sp... | github_jupyter |
# Recommendations with IBM
In this notebook, you will be putting your recommendation skills to use on real data from the IBM Watson Studio platform.
You may either submit your notebook through the workspace here, or you may work from your local machine and submit through the next page. Either way assure that your ... | github_jupyter |
# Applying GrandPrix on the cell cycle single cell nCounter data of PC3 human prostate cancer
_Sumon Ahmed_, 2017, 2018
This notebooks describes how GrandPrix with informative prior over the latent space can be used to infer the cell cycle stages from the single cell nCounter data of the PC3 human prostate cancer cell... | github_jupyter |
---
_You are currently looking at **version 1.1** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-data-analysis/resources/0dhYG) course resource._
---
# The Python Programm... | github_jupyter |
```
from elasticsearch import Elasticsearch
from random import randint
es = Elasticsearch([{'host': 'localhost', 'port': 9200}], http_auth=('xxxxxxx', 'xxxxxxxxx'))
# ~ 6,000,000 companies
# ~ 4,000 colleges
ratio ==> 1500 companies per one college
6000000/4000
doc = {'email':'name_'+str(i)+'@email.com',
'numbe... | github_jupyter |
```
import numpy as np
class Perception(object):
'''
Created on May 14th, 2017
Perception: A very simple model for binary classification
@author: Qi Gong
'''
def __init__(self, eta = 0.01, n_iter = 10):
self.eta = eta
self.n_iter = n_iter
def fit(self, X, y):
... | github_jupyter |
# Sequences
## `sequence.DNA`
`coral.DNA` is the core data structure of `coral`. If you are already familiar with core python data structures, it mostly acts like a container similar to lists or strings, but also provides further object-oriented methods for DNA-specific tasks, like reverse complementation. Most desig... | github_jupyter |
```
import os
os.chdir('C:\\Users\\SHAILESH TIWARI\\Downloads\\Classification\\hr')
%matplotlib inline
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
train = pd.read_csv('train.csv')
# getting their shapes
print("Shape of train :", train.shape)
#print("Shape of test :", tes... | github_jupyter |
```
import numpy as np
from numpy import array
import random
from random import randint
import os
import matplotlib.pyplot as plt
import pandas as pd
import keras
from keras.models import Sequential
from keras.layers import Dense, Conv1D, Flatten, Activation, MaxPooling1D, Dropout
from keras.optimizers import SGD
os... | github_jupyter |
# Simple Neural Networks: Revised
Back in February I published a post title [<i>Simple Neural Networks with Numpy</i>](https://a-i-dan.github.io/tanh_NN). I wanted to take a deep dive into the world of neural networks and learn everything that went into making a neural net seem "magical". Now, a few months later, I wa... | github_jupyter |
```
# help function
from transfer_learning import NeuralNet_sherpa_optimize
from dataset_loader import data_loader, get_descriptors, one_filter, data_scaler
# modules
import torch
import torch.nn as nn
import torch.optim as optim
import os
import numpy as np
import pandas as pd
from sklearn.model_selection import tr... | github_jupyter |
# 3. Image-Similar-FCNN-Binary
For landmark-recognition-2019 algorithm validation
## Run name
```
import time
project_name = 'Dog-Breed'
step_name = '3-Image-Similar-FCNN-Binary'
time_str = time.strftime("%Y%m%d-%H%M%S", time.localtime())
run_name = project_name + '_' + step_name + '_' + time_str
print('run_name: ' ... | github_jupyter |
# Support Vector Machine
```
from PIL import Image
import numpy as np
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
from sklearn import datasets, svm, linear_model
matplotlib.style.use('bmh')
matplotlib.rcParams['figure.figsize']=(10,10)
```
### 2D Linear
```
# Random 2d X
X0 = np.random.norma... | github_jupyter |
<img src="http://drive.google.com/uc?export=view&id=1tpOCamr9aWz817atPnyXus8w5gJ3mIts" width=500px>
Proprietary content. © Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.
---
# Hands-on - Advanced Certificate in Software Engineering - IIT Madras
---
# Instructions
- You need to add... | github_jupyter |
```
import sys
import numpy as np
```
# Numpy
Numpy proporciona un nuevo contenedor de datos a Python, los `ndarray`s, además de funcionalidad especializada para poder manipularlos de forma eficiente.
Hablar de manipulación de datos en Python es sinónimo de Numpy y prácticamente todo el ecosistema científico de Pyth... | github_jupyter |
### Processing Echosounder Data from Ocean Observatories Initiative with `echopype`.
Downloading a file from the OOI website. We pick August 21, 2017 since this was the day of the solar eclipse which affected the traditional patterns of the marine life.
```
# downloading the file
!wget https://rawdata.oceanobservator... | github_jupyter |
# Book-Crossing Recommendation System
> Book recommender system on book crossing dataset using surprise SVD and NMF models
- toc: true
- badges: true
- comments: true
- categories: [Surprise, SVD, NMF, Book]
- author: "<a href='https://github.com/tttgm/fellowshipai'>Tom McKenzie</a>"
- image:
## Setup
```
!pip insta... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import pandas as pd
from tqdm import tqdm
import metnum
import numpy
from sklearn.utils import shuffle
from sklearn.metrics import accuracy_score,precision_score,recall_score,f1_score
import csv
import time
def correr_Knn_con_k_aumentando_en(porcentage_para_entrenar,cant_muestras=... | github_jupyter |
Variables with more than one value
==================================
You have already seen ordinary variables that store a single value. However other variable types can hold more than one value. The simplest type is called a list. Here is a example of a list being used:
```
which_one = int(input("What month (1-12... | github_jupyter |
# Control of a hydropower dam
Consider a hydropower plant with a dam. We want to control the flow through the dam gates in order to keep the amount of water at a desired level.
<p><img src="hydropowerdam-wikipedia.png" alt="Hydro power from Wikipedia" width="400"></p>
The system is a typical integrator, and is given ... | github_jupyter |
```
import pandas as pd
df = pd.read_csv(filepath_or_buffer='https://raw.githubusercontent.com/justmarkham/DAT8/master/data/chipotle.tsv', sep='\t').iloc[:100,:]
df.head()
```
## Cuantos pedidos por cada orden?
```
mask = df['order_id'] == 1
df[mask]
df[mask].quantity
df[mask].quantity.sum()
mask = df['order_id'] == ... | github_jupyter |
### Simulate the flight reservation process (MZ685 Case Vocram)
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from random import random
# Constants
FLIGHTS = 1000 # The number of flights for simulation (can be changed)
CALLS = 10 # The number of calls for each flight
SEATS = 3 ... | github_jupyter |
```
import warnings
warnings.filterwarnings('ignore')
import nltk
nltk.download('stopwords')
nltk.download('punkt')
nltk.download('wordnet')
from nltk.corpus import stopwords
import pandas as pd
import numpy as np
from glove import Glove
from sklearn.preprocessing import LabelEncoder
from sklearn import metrics
from ... | github_jupyter |
```
# https://community.plotly.com/t/different-colors-for-bars-in-barchart-by-their-value/6527/7
%reset
# Run this app with `python app.py` ando
# visit http://127.0.0.1:8050/ in your web browser.
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import jupy... | github_jupyter |
# Hawaii - A Climate Analysis And Exploration
### For data between August 23, 2016 - August 23, 2017
---
```
# Import dependencies
%matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
# Python SQL tool... | github_jupyter |
```
import os
import glob
base_dir = os.path.join('F:/0Sem 7/B.TECH PROJECT/0Image data/cell_images')
infected_dir = os.path.join(base_dir,'Parasitized')
healthy_dir = os.path.join(base_dir,'Uninfected')
infected_files = glob.glob(infected_dir+'/*.png')
healthy_files = glob.glob(healthy_dir+'/*.png')
print("Infected sa... | github_jupyter |
# Imdb sentiment classification.
Dataset of 25,000 movies reviews from IMDB, labeled by sentiment (positive/negative). Reviews have been preprocessed, and each review is encoded as a sequence of word indexes (integers). For convenience, words are indexed by overall frequency in the dataset, so that for instance the in... | github_jupyter |
##### Copyright 2020 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | github_jupyter |
# PageRank
In this notebook, you'll build on your knowledge of eigenvectors and eigenvalues by exploring the PageRank algorithm.
The notebook is in two parts, the first is a worksheet to get you up to speed with how the algorithm works - here we will look at a micro-internet with fewer than 10 websites and see what it ... | github_jupyter |
```
import pandas as pd
import numpy as np
import h5py
import matplotlib.pyplot as plt
import scipy
from PIL import Image
from scipy import ndimage
#from dnn_app_utils_v2 import *
import pandas as pd
%matplotlib inline
from pandas import ExcelWriter
from pandas import ExcelFile
%load_ext autoreload
%autoreload 2
from s... | github_jupyter |
## sigMF STFT on GPU and CPU
```
import os
import itertools
from sklearn.utils import shuffle
import torch, torchvision
import torch.nn as nn
import torch.nn.functional as d
import torch.optim as optim
import torch.nn.functional as F
import torch.nn.modules as mod
import torch.utils.data
import torch.utils.data as dat... | github_jupyter |
```
import numpy as np
from matplotlib import pyplot as plt
def relu(z):
return max(0, z)
def sigmoid(z):
return (1/(1+np.exp(-z)))
def layer_sizes(X, Y):
"""
Arguments:
X -- input dataset of shape (input size, number of examples)
Y -- labels of shape (output size, number of examples)
"""
... | github_jupyter |
# Training and Data Sets
Author: Ravin Poudel
Main goal in the statistical or machine learning model is to biuld a generalized predictive-model. Often we start with a set of data to build a model and describe the model fit and other properties. However, it is equally important to test the model with new data (the data... | github_jupyter |
# LKJ Cholesky Covariance Priors for Multivariate Normal Models
While the [inverse-Wishart distribution](https://en.wikipedia.org/wiki/Inverse-Wishart_distribution) is the conjugate prior for the covariance matrix of a multivariate normal distribution, it is [not very well-suited](https://github.com/pymc-devs/pymc3/is... | github_jupyter |
# Forecasting on Contraceptive Use - A Multi-step Ensemble Approach¶
Update: 09/07/2020
Github Repository: https://github.com/herbsh/USAID_Forecast_submit
## key idea
- The goal is to forecast on site_code & product_code level demand.
- The site_code & product_code level demand fluctuates too much and doesn't hav... | github_jupyter |
% 30 Days of Kaggle - Day 10: (https://www.kaggle.com/dansbecker/underfitting-and-overfitting)[Over-Fitting and Under-Fitting].
Now that I can create models I need to be able to evaluate their accuracy.
I calculated mean absolute error in the last notebook using sklearn.
MAE = \frac{\sum_0^N | predicted - actual |}{... | github_jupyter |
```
import numpy as np
import pandas as pd
# from sklearn.preprocessing import
from sklearn.model_selection import train_test_split
from random import randint
import sklearn.metrics as skm
from xgboost import XGBClassifier
import xgboost as xgb
from sklearn.metrics import roc_curve
from matplotlib import pyplot as plt
... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from os.path import join
import seaborn as sns
```
# Build results tables
```
N_patients = {
"AM":14646484,
"AU":973941,
"CH":521211,
"DER":771281,
"GGH":748889,
"HNO":564501,
"IM":1693363,
"KI":743235,
"NE... | github_jupyter |
```
# Import Dependencies
import pandas as pd
from bs4 import BeautifulSoup as bs
import requests
from splinter import Browser
from splinter.exceptions import ElementDoesNotExist
from IPython.display import HTML
#browser = Browser()
# Create a path to use for splinter
executable_path = {'executable_path' : 'chromedriv... | github_jupyter |
# tensorflow-compress
[](https://colab.research.google.com/github/byronknoll/tensorflow-compress/blob/master/tensorflow-compress.ipynb)
Made by Byron Knoll. GitHub repository: https://github.com/byronknoll/tensorflow-compress
### Description
... | github_jupyter |
```
%matplotlib inline
%load_ext autoreload
%autoreload 2
import os
import sys
from os.path import exists
sys.path.append('../..')
import pylab as plt
import pandas as pd
import numpy as np
from loguru import logger
import seaborn as sns
from stable_baselines3 import PPO, DQN
from vimms.Common import POSITIVE, set_l... | github_jupyter |
# Random Walks
This week we will discuss a new topic, *random walks*. Random walks are an example of a markov process, and we will also learn what this means, and how we can analyze the behavior of the random walker using a markov chain.
The exercises this week are slightly more extensive then other weeks, and is mor... | github_jupyter |
## Define the Convolutional Neural Network
After you've looked at the data you're working with and, in this case, know the shapes of the images and of the keypoints, you are ready to define a convolutional neural network that can *learn* from this data.
In this notebook and in `models.py`, you will:
1. Define a CNN w... | github_jupyter |
# Data Visualization With Safas
This notebook demonstrates plotting the results from Safas video analysis.
## Import modules and data
Import safas and other components for display and analysis. safas has several example images in the safas/data directory. These images are accessible as attributes of the data module... | github_jupyter |
# In-Class Coding Lab: Iterations
The goals of this lab are to help you to understand:
- How loops work.
- The difference between definite and indefinite loops, and when to use each.
- How to build an indefinite loop with complex exit conditions.
- How to create a program from a complex idea.
# Understanding Iterati... | github_jupyter |
# 3. Example: Univariate Gaussian
```
# Install and load deps
if (!require("stringr")) {
install.packages("stringr")
}
library(purrr)
```
As an example, we consider the heights in cm of 20 individuals:
We will model the heights using the univariate Gaussian. The univariate Gaussian has two
parameters, its mean... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.