code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
<h2 align="center">INF575 - Fuzzy Logic</h2>
<h1 align="center">Segmentation of HER2 Overexpression in Histopathology Images with Fuzzy Decision Tree<h1>
<center>
<img src="https://rochepacientes.es/content/dam/roche-pacientes-2/es/assets/images/que-es-her2.jpg" width="60%"/>
</center>
<h2 align="center">Clas... | github_jupyter |
```
from sys import modules
IN_COLAB = 'google.colab' in modules
if IN_COLAB:
!pip install -q ir_axioms[examples] python-terrier
# Start/initialize PyTerrier.
from pyterrier import started, init
if not started():
init(tqdm="auto", no_download=True)
from pyterrier.datasets import get_dataset, Dataset
# Load d... | github_jupyter |
# DAT210x - Programming with Python for DS
## Module5- Lab5
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot') # Look Pretty
```
### A Convenience Function
```
def plotDecisionBoundary(model, X, y):
fig = plt.figure()
ax = fig.add_sub... | github_jupyter |
```
# -*- coding: utf-8 -*-
"""
EVCのためのEV-GMMを構築します. そして, 適応学習する.
詳細 : https://pdfs.semanticscholar.org/cbfe/71798ded05fb8bf8674580aabf534c4dbb8bc.pdf
This program make EV-GMM for EVC. Then, it make adaptation learning.
Check detail : https://pdfs.semanticscholar.org/cbfe/71798ded05fb8bf8674580abf534c4dbb8bc.pdf
"""
... | github_jupyter |
Code:<a href="https://github.com/lotapp/BaseCode" target="_blank">https://github.com/lotapp/BaseCode</a>
多图旧排版:<a href="https://www.cnblogs.com/dunitian/p/9119986.html" target="_blank">https://www.cnblogs.com/dunitian/p/9119986.html</a>
在线编程:<a href="https://mybinder.org/v2/gh/lotapp/BaseCode/master" target="_blank">... | github_jupyter |
###### Text provided under a Creative Commons Attribution license, CC-BY. Code under MIT license. (c)2014 Lorena A. Barba, Pi-Yueh Chuang. Thanks: NSF for support via CAREER award #1149784.
# Source Distribution on an Airfoil
In [Lesson 3](03_Lesson03_doublet.ipynb) of *AeroPython*, you learned that it is possible to... | github_jupyter |
Copyright 2021 Google LLC.
SPDX-License-Identifier: Apache-2.0
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 agre... | github_jupyter |
## Trigger Word Detection
Welcome to the final programming assignment of this specialization!
In this week's videos, you learned about applying deep learning to speech recognition. In this assignment, you will construct a speech dataset and implement an algorithm for trigger word detection (sometimes also called key... | github_jupyter |
# Module - 2: Data visualization and Technical Analysis
###### Loading required libraries
```
import pandas as pd # data loading tool
import matplotlib.pyplot as plt #ploting tool
import seaborn as sns
import numpy as np
```
## 2.1 Loading dataset and changing the Date format
```
mod2_data = pd.read_csv('week... | github_jupyter |
## Importing and mapping netCDF data with xarray and cartopy
- Read data from a netCDF file with xarray
- Select (index) and modify variables using xarray
- Create user-defined functions
- Set up map features with cartopy (lat/lon tickmarks, continents, country/state borders); create a function to automate these steps... | github_jupyter |
# Add external catalog for source matching: allWISE catalog
This notebook will create a dabase containing the allWISE all-sky mid-infrared catalog. As the catalogs grows (the allWISE catalog we are inserting contains of the order of hundreds of millions sources), using an index on the geoJSON corrdinate type to suppor... | github_jupyter |
```
# Update sklearn to prevent version mismatches
!pip install sklearn --upgrade
# install joblib. This will be used to save your model.
# Restart your kernel after installing
!pip install joblib
import pandas as pd
```
# Read the CSV and Perform Basic Data Cleaning
```
df = pd.read_csv("exoplanet_data.csv")
# Dro... | github_jupyter |
# Homework #3 Programming Assignment
CSCI567, Spring 2019<br>Victor Adamchik<br>**Due: 11:59 pm, March 3rd 2019**
### Before you start:
On Vocareum, when you submit your homework, it takes around 5-6 minutes to run the grading scripts and evaluate your code. So, please be patient regarding the same.<br>
## Office ... | github_jupyter |
 | [FREYA](https://www.project-freya.eu/en) WP2 [User Story 10](https://github.com/datacite/freya/issues/45) | As a funder, we want to be able to find all the outputs related to our awarded grants, includi... | github_jupyter |
<a id="title_ID"></a>
# JWST Pipeline Validation Testing Notebook: spec2, extract_2d step
<span style="color:red"> **Instruments Affected**</span>: NIRSpec
Tested on CV3 data
### Table of Contents
<div style="text-align: left">
<br> [Imports](#imports_ID) <br> [Introduction](#intro_ID) <br> [Testing Data Set](#da... | github_jupyter |
# Pump Calculations
```
import numpy as np
```
## Power Input
```
#Constants and inputs
g = 32.174; #gravitational acceleration, ft/s^2
rho_LOx = 71.27; #Density of Liquid Oxygen- lbm/ft^3
rho_LCH4 = 26.3; #Density of Liquid Methane- lbm/ft^3
Differential = #Desired pressure differential (psi)
mLOx = #Mass flow of... | github_jupyter |
```
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from functools import partial
n_inputs = 28*28
n_hidden1 = 100
n_hidden2 = 100
n_hidden3 = 100
n_hidden4 = 100
n_hidden5 = 100
n_outputs = 5
# Let's define the placeholders for the inputs and the targets
X = tf.pl... | github_jupyter |
# LB-Colloids Colloid particle tracking
LB-Colloids allows the user to perform colloid and nanoparticle tracking simulations on Computational Fluid Dynamics domains. As the user, you supply the chemical and physical properties, and the code performs the mathematics and particle tracking!
Let's set up our workspace to... | github_jupyter |
```
%%javascript
IPython.OutputArea.prototype._should_scroll = function(lines) {
return false;
}
import matplotlib.pyplot as plt
import numpy as np
dt = 0.1
def draw_plot(measurements, mlabel=None, estimates=None, estlabel=None, title=None, xlabel=None, ylabel=None):
xvals = np.linspace(0, dt * len(measuremen... | github_jupyter |
# Self-Driving Car Engineer Nanodegree
## Deep Learning
## Project: Build a Traffic Sign Recognition Classifier
In this notebook, a template is provided for you to implement your functionality in stages, which is required to successfully complete this project. If additional code is required that cannot be included i... | github_jupyter |
```
import os
path = '/home/yash/Desktop/tensorflow-adversarial/tf_example'
os.chdir(path)
# supress tensorflow logging other than errors
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn import ModeKeys, Estimator
import matplotlib
matplotlib.use('Agg')
... | github_jupyter |
```
###### Applications Lab #1-- ATOC7500 Objective Analysis - bootstrapping
##### Originally coded by Prof. Kay (CU) with input from Vineel Yettella (CU ATOC Ph.D. 2018)
##### last updated September 2, 2020
###LEARNING GOALS:
###1) Working in an ipython notebook: read in csv file, make histogram plot
###2) Assessing ... | github_jupyter |
# Feature selection
We will select a group of variables, the most predictive ones, to build our machine learning model
## Why do we select variables?
- For production: Fewer variables mean smaller client input requeriments(e.q customers filling out a form on a webiste or mobile app), and hence less code for error han... | github_jupyter |
# A Baseline Named Entity Recognizer for Twitter
In this notebook I'll follow the example presented in [Named entities and random fields](http://www.orbifold.net/default/2017/06/29/dutch-ner/) to train a conditional random field to recognize named entities in Twitter data. The data and some of the code below are taken... | github_jupyter |
```
!pip install pyclustering
%load_ext autoreload
%autoreload 2
from Clique.Clique import *
from load_logs import *
from evaluation import *
from features import *
from visualize import *
import matplotlib.pyplot as plt
import numpy as np
logs, log_labels = read_logs_and_labels("./Saved/logs.txt", "./Saved/labels.txt"... | github_jupyter |
```
import ipywidgets
tabs = ipywidgets.Tab()
tabs.children = [ipywidgets.Label(value='tab1'), ipywidgets.Label(value='tab2'), ipywidgets.Label(value='tab3'), ipywidgets.Label(value='tab4')]
tabs.observe(lambda change: print(f"selected index: {change['new']}") , names='selected_index')
def change_children(_):
id ... | github_jupyter |
# Home Credit Default Risk
Can you predict how capable each applicant is of repaying a loan?
Many people struggle to get loans due to **insufficient or non-existent credit histories**. And, unfortunately, this population is often taken advantage of by untrustworthy lenders.
Home Credit strives to broaden financial i... | github_jupyter |
```
library(repr) ; options(repr.plot.width = 5, repr.plot.height = 6) # Change plot sizes (in cm)
```
# Bootstrapping using rTPC package
## Introduction
In this Chapter we will work through an example of model fitting using the rTPC package in R. This references the previous chapters' work, especially [Model Fitting... | github_jupyter |
```
# import libraries
import numpy as np
import pandas as pd
from numpy import genfromtxt
import math
from scipy import optimize
import matplotlib.pyplot as plt
import csv
import sqlite3
import os
import urllib.request
# Function for the SIR model with two levels of alpha and beta -- O(n) speed
#
# INPUTS
#
# S0 - in... | github_jupyter |
# Targeting Direct Marketing with Amazon SageMaker XGBoost
_**Supervised Learning with Gradient Boosted Trees: A Binary Prediction Problem With Unbalanced Classes**_
---
## Background
Direct marketing, either through mail, email, phone, etc., is a common tactic to acquire customers. Because resources and a customer'... | github_jupyter |
# Redcard Exploratory Data Analysis
This dataset is taken from a fantastic paper that looks to see how analytical choices made by different data science teams on the same dataset in an attempt to answer the same research question affect the final outcome.
[Many analysts, one dataset: Making transparent how variations... | github_jupyter |
# Machine Learning
## Types of learning
- Whether or not they are trained with human supervision (supervised, unsupervised, semisupervised, and Reinforcement Learning)
- Whether or not they can learn incrementally on the fly (online versus batch learning)
- Whether they work by simply comparing new data points to know... | github_jupyter |
<img src="https://raw.githubusercontent.com/Qiskit/qiskit-tutorials/master/images/qiskit-heading.png" alt="Note: In order for images to show up in this jupyter notebook you need to select File => Trusted Notebook" width="500 px" align="left">
## _*Superposition*_
The latest version of this notebook is available on ... | github_jupyter |
```
%matplotlib inline
import numpy as np
import pandas as pd
from scipy import signal, ndimage, interpolate, stats
from scipy.interpolate import CubicSpline
from itertools import combinations
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.ticker import FormatStrFormatter
from matp... | github_jupyter |
# BSM
## Assumptions:
- Price of underlying asset follows a lognormal dist; return ~ normal
- $r_f^c$ is known and constant
- volatility $\sigma$ of underlying asset is known and constant
- Frictionless market
- No cash flow* (dividend)
- European options
## Formula
### European Call
$$c_0= S_0e^{-qT}*N(d1)- Xe^{-R_f... | github_jupyter |
# Caso de uso: Agrupación de textos por temáticas similares
**Autor:** Unidad de Científicos de Datos (UCD)
---
Este es un caso de uso que utiliza varias funcionalidades de la libtería **ConTexto** para procesar y vectorizar textos de noticias sobre diferentes temas. Luego, sobre estos vectores se aplica t-SNE, una té... | github_jupyter |
```
### imports
#
import pandas as pd
import numpy as np
#
import gzip
import csv
import json
import string
import warnings
warnings.filterwarnings('ignore')
#
from distutils.util import strtobool
# pickle
import pickle
#
from sklearn.neighbors import NearestNeighbors
```
EDA
```
# convert files
asheville = pd.read... | github_jupyter |
```
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torchvision
from torchvision import datasets
from torchvision import transforms
from torchvision.utils import save_image
from torchsummary import summary
from matplotlib import pyplot as plt
#from pushove... | github_jupyter |
```
import mdptoolbox
import matplotlib.pyplot as plt
import numpy as np
import scipy.sparse as ss
import seaborn as sns
import warnings
warnings.filterwarnings('ignore', category=ss.SparseEfficiencyWarning)
# params
alpha = 0.9
T = 8
state_count = (T+1) * (T+1)
epsilon = 10e-5
# game
action_count = 3
adopt = 0; overr... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Grid-Search" data-toc-modified-id="Grid-Search-1"><span class="toc-item-num">1 </span>Grid Search</a></span></li><li><span><a href="#Best-params-result" data-toc-modified-id="Best-params-result-2... | github_jupyter |
### Image Classification - Conv Nets -Pytorch
> Classifying if an image is a `bee` of an `ant` using `ConvNets` in pytorch
### Imports
```
import cv2
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
import torch
from torch import nn
import torch.nn.functional as... | github_jupyter |
# Data Pre-Processing
When training any sort of model using a machine learning algorithm, a large dataset is first needed to train that model off of. Data can be anything that would help benefit with the training of the model. In this case, images of people facing the camera head on wearing/not wearing a face mask is ... | github_jupyter |
# Using Models as Layers in Another Model
In this notebook, we show how you can use Keras models as Layers within a larger model and still perform pruning on that model.
```
# Import required packages
import tensorflow as tf
import mann
from sklearn.metrics import confusion_matrix, classification_report
# Load the ... | github_jupyter |
# Data Visualization Using Plotly
##### To visualize plots in this notebook please click [here](https://nbviewer.jupyter.org/github/hirenhk15/ga-code-alongs/blob/main/1_Introduction_to_plotly/notebook/Plotly_data_visualization.ipynb)
```
# Import packages
import cufflinks
import plotly
import plotly.graph_objects as ... | github_jupyter |
```
import pathlib
import lzma
import re
import os
import datetime
import copy
import functools
import numpy as np
import pandas as pd
# Makes it so any changes in pymedphys is automatically
# propagated into the notebook without needing a kernel reset.
from IPython.lib.deepreload import reload
%load_ext autoreload
%a... | github_jupyter |
```
#|hide
#|skip
! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab
#|all_slow
#|export
from __future__ import annotations
from fastai.basics import *
from fastai.callback.progress import *
from fastai.text.data import TensorText
from fastai.tabular.all import TabularDataLoaders, Tabular
from fast... | github_jupyter |
```
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
import torch.utils.data as data
train_data_path = "./train"
transform = transforms.Compose([
transforms.Resize((64, 64)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.45... | github_jupyter |
<figure>
<IMG SRC="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d5/Fachhochschule_Südwestfalen_20xx_logo.svg/320px-Fachhochschule_Südwestfalen_20xx_logo.svg.png" WIDTH=250 ALIGN="right">
</figure>
# Skriptsprachen
### Sommersemester 2021
Prof. Dr. Heiner Giefers
# Covid-19 Daten visualisieren
In dieser k... | github_jupyter |
# Load Necessary Libraries
```
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
```
# Hide warning messages in notebook
```
import warnings
warnings.filterwarnings('ignore')
```
# Load in data
```
mouse_drug_data = pd.read_csv('data/mouse_drug_data.csv')
mouse_drug_data.hea... | github_jupyter |
# Transform JD text files into an LDA model and pyLDAvis visualization
### Steps:
1. Use spaCy phrase matching to identify skills
2. Parse the job descriptions. A full, readable job description gets turned into a bunch of newline-delimited skills.
3. Create a Gensim corpus and dictionary from the parsed skills
4. Trai... | github_jupyter |
# Unconstrainted optimization with NN models
In this tutorial we will go over type 1 optimization problem which entails nn.Module rerpesented cost function and __no constarint__ at all. This type of problem is often written as follows:
$$ \min_{x} f_{\theta}(x) $$
we can find Type1 problems quite easily. For instance... | github_jupyter |
```
import pdal
import warnings
warnings.filterwarnings('ignore')
# import geoplot as gplt
# import geoplot.crs as gcrs
import geopandas as gpd
import imageio
import pathlib
import mapclassify as mc
import numpy as np
import laspy
import rasterio
from rasterio import mask
import folium
import matplotlib.pyplot as plt
i... | github_jupyter |
# Function Practice Exercises
Problems are arranged in increasing difficulty:
* Warmup - these can be solved using basic comparisons and methods
* Level 1 - these may involve if/then conditional statements and simple methods
* Level 2 - these may require iterating over sequences, usually with some kind of loop
* Chall... | github_jupyter |
*This notebook contains an excerpt from the [Whirlwind Tour of Python](http://www.oreilly.com/programming/free/a-whirlwind-tour-of-python.csp) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/WhirlwindTourOfPython).*
*The text and code are released under the [CC0](https://github.com/... | github_jupyter |
<!-- :Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu> -->
<!-- :Date: 2020-08-02 -->
<!-- :Copyright: 2020, Karr Lab -->
<!-- :License: MIT -->
# DE-Sim: Ordering simultaneous events
DE-Sim makes it easy to build and simulate discrete-event models.
This notebook discusses DE-Sim's methods for controlling the execut... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib as plt
import seaborn as sns
%matplotlib inline
```
# Build dataframe with data for plotting
http://koaning.io/radial-basis-functions.html
$\phi_{i} (x) = exp\left( \frac{-1}{2 \alpha} (x-m_i)^2 \right)$
```
def rbf(x, alpha, m):
return np.exp(-1/(2*... | github_jupyter |
```
%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import cm
import pandas as pd
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['text.latex.unicode'] = True
blues = cm.get_cmap(plt.get_cmap('Blues'))
greens = cm.get_cmap(plt.get_cmap('Greens'))
reds... | github_jupyter |
# HandGestureDetection using OpenCV
This code template is for Hand Gesture detection in a video using OpenCV Library.
### Required Packages
```
!pip install opencv-python
!pip install mediapipe
import cv2
import mediapipe as mp
import time
```
### Hand Detection
For detecting hands in the image, we use the detectM... | github_jupyter |
The purpose of this notebook is to convert the wide-format car data to long-format. The car data comes from the mlogit package. The data description is reproduced below. Note the data originally comes from McFadden and Train (2000).
#### Description
- Cross-Sectional Dataset
- Number of Observations: 4,654
- Unit of O... | github_jupyter |
# Score for the Fed's dual mandate
The U.S. Congress established three key objectives for monetary policy
in the Federal Reserve Act: *Maximum employment, stable prices*, and
moderate long-term interest rates. The first two objectives are
sometimes referred to as the Federal Reserve's **dual mandate**.
Here we ex... | github_jupyter |
# 1 Getting started – Python, Platform and Jupyter
```
print("HelloWorld!")
```
# 2 Numpy
### 2.1 Arrays
##### 1. Run the following:
```
import numpy as np
a = np.array([1, 2, 3])
print(type(a))
print(a.shape)
print(a[0], a[1], a[2])
a[0] = 5
print(a[0], a[1], a[2])
```
What are the rank, shape of a, and the curr... | github_jupyter |
# ¿Cómo medir rendimiento y riesgo en un portafolio? II
<img style="float: right; margin: 0px 0px 15px 15px;" src="http://www.picpedia.org/clipboard/images/stock-portfolio.jpg" width="600px" height="400px" />
> La clase pasada y la presente, están dedicadas a obtener medidas de rendimiento y riesgo en un portafolio.
... | github_jupyter |
# <center>Welcome to Supervised Learning</center>
## <center>Part 2: How to prepare your data for supervised machine learning</center>
## <center>Instructor: Andras Zsom</center>
### <center>https://github.com/azsom/Supervised-Learning<center>
## The topic of the course series: supervised Machine Learning (ML)
- how t... | github_jupyter |
<center>
<img src="https://github.com/Yorko/mlcourse.ai/blob/master/img/ods_stickers.jpg?raw=true" />
<br>
<div style="font-weight:700;font-size:25px"> [mlcourse.ai](https://mlcourse.ai) - Open Machine Learning Course </div>
<br>
Auteurs: [Vitaliy Radchenko](https://www.linkedin.com/in/vitaliyradchenk0/) et [Yu... | github_jupyter |
## 2. Random Forest
### a)
```
import pandas as pd
headers = ["Number of times pregnant",
"Plasma glucose concentration a 2 hours in an oral glucose tolerance test",
"Diastolic blood pressure (mm Hg)",
"Triceps skinfold thickness (mm)",
"2-Hour serum insulin (mu U/ml)",
... | github_jupyter |
<div>
<h1 style="text-align: center;">Machine learning from scratch - Part II</h1>
<h2 style="text-align: center;">EMBO practical course on population genomics 2019 @ Procida, Italy</h2>
<div>
---
### Authors: Marco Chierici & Margherita Francescatto
### _FBK/MPBA_
---
**Recap.** We are using a subset of th... | github_jupyter |
```
import numpy as np
from scipy.spatial import Delaunay
from scipy.interpolate import LinearNDInterpolator
from scipy.constants import mu_0
from scipy.constants import elementary_charge as q_e
from scipy.constants import proton_mass as m_i
from astropy.convolution import convolve, convolve_fft
from scipy.signal impor... | github_jupyter |
# Similarity Encoders with Keras
## using the model definition from `simec.py`
```
from __future__ import unicode_literals, division, print_function, absolute_import
from builtins import range
import numpy as np
np.random.seed(28)
import matplotlib.pyplot as plt
from sklearn.manifold import Isomap
from sklearn.decompo... | github_jupyter |
# Analyzing data from clusters FAMD-v6
```
import pandas as pd
import numpy as np
import json
import datetime as dt
import seaborn as sns
import matplotlib.pyplot as plt
import statsmodels.api as sm
import statsmodels.formula.api as smf
import statsmodels.stats.multicomp as multi
import scipy.stats
# Configuración de ... | github_jupyter |
** ----- IMPORTANT ------ **
The code presented here assumes that you're running TensorFlow v1.3.0 or higher, this was not released yet so the easiet way to run this is update your TensorFlow version to TensorFlow's master.
To do that go [here](https://github.com/tensorflow/tensorflow#installation) and then exec... | github_jupyter |
```
from autoreduce import *
import numpy as np
from sympy import symbols
# Post conservation law and other approximations phenomenological model at the RNA level
n = 4 # Number of states
nouts = 2 # Number of outputs
# Inputs by user
x_init = np.zeros(n)
n = 4 # Number of states
timepoints_ode = np.linspace(0, 100... | github_jupyter |
```
# Define a smallest_number function that accepts a list of numbers.
# It should return the smallest value in the list.
def smallest_number(numbers):
numbers = list(numbers)
smallest = numbers[0]
for number in numbers:
if number < smallest:
smallest = number
return smallest
sma... | github_jupyter |
```
from matplotlib import pyplot as plt
from matplotlib import cm
import pandas as pd
from pprint import pprint
from random import randint, random, gauss, uniform
import numpy as np
#import matplotlib as mpl
#mpl.rcParams['text.usetex'] = True
#mpl.rcParams['text.latex.unicode'] = True
blues = cm.get_cmap(plt.get_cm... | github_jupyter |
```
# Use Splinter to navigate the sites when needed and BeautifulSoup to help find and parse out the necessary data.
from splinter import Browser
from bs4 import BeautifulSoup
import pandas as pd
from selenium import webdriver
```
# NASA Mars News
```
executable_path = {"executable_path": "chromedriver"}
browser = B... | github_jupyter |
# Understanding the FFT Algorithm
Copy from http://jakevdp.github.io/blog/2013/08/28/understanding-the-fft/
*This notebook first appeared as a post by Jake Vanderplas on [Pythonic Perambulations](http://jakevdp.github.io/blog/2013/08/28/understanding-the-fft/). The notebook content is BSD-licensed.*
<!-- PELICAN_BEG... | github_jupyter |
```
# default_exp label
```
# Label
> A collection of functions to do label-based quantification
```
#hide
from nbdev.showdoc import *
```
## Label search
The label search is implemented based on the compare_frags from the search.
We have a fixed number of reporter channels and check if we find a respective peak ... | github_jupyter |
# For today's code challenge you will be reviewing yesterdays lecture material. Have fun!
### if you get done early check out [these videos](https://www.3blue1brown.com/neural-networks).
# The Perceptron
The first and simplest kind of neural network that we could talk about is the perceptron. A perceptron is just a ... | github_jupyter |
# Random Forest
on the penguin dataset
```
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import make_pipeline
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import OneHotEncoder... | github_jupyter |
```
import numpy as np
import pandas as pd
import warnings
warnings.filterwarnings('ignore')
import seaborn as sns
sns.set_palette('Set2')
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.metrics import confusion_matrix, mean_squared_error
from sklearn.preprocessing import LabelEncoder, MinMaxScaler, ... | github_jupyter |
# Numpy
### GitHub repository: https://github.com/jorgemauricio/curso_itesm
### Instructor: Jorge Mauricio
```
# librerías
import numpy as np
```
# Crear Numpy Arrays
## De una lista de python
Creamos el arreglo directamente de una lista o listas de python
```
my_list = [1,2,3]
my_list
np.array(my_list)
my_matrix ... | github_jupyter |
```
from transformers import (
AutoConfig,
AutoModelForSeq2SeqLM,
AutoTokenizer,
DataCollatorForSeq2Seq,
HfArgumentParser,
MBartTokenizer,
default_data_collator,
AutoModelWithLMHead,
set_seed
)
model_name = "./models/First/"
model = AutoModelWithLMHead.from_pretrained(model_name)
tok... | github_jupyter |
```
import os
import numpy as np
import pandas as pd
import glob
from prediction_utils.util import yaml_read, df_dict_concat
table_path = '../figures/hyperparameters/'
os.makedirs(table_path, exist_ok = True)
param_grid_base = {
"lr": [1e-3, 1e-4, 1e-5],
"batch_size": [128, 256, 512],
"drop_prob... | github_jupyter |
# 时间序列预测
时间序列是随着时间的推移定期收集的数据。时间序列预测是指根据历史数据预测未来数据点的任务。时间序列预测用途很广泛,包括天气预报、零售和销量预测、股市预测,以及行为预测(例如预测一天的车流量)。时间序列数据有很多,识别此类数据中的模式是很活跃的机器学习研究领域。
<img src='notebook_ims/time_series_examples.png' width=80% />
在此 notebook 中,我们将学习寻找时间规律的一种方法,即使用 SageMaker 的监督式学习模型 [DeepAR](https://docs.aws.amazon.com/sagemaker/latest/dg/deep... | github_jupyter |
# Neural networks with PyTorch
Deep learning networks tend to be massive with dozens or hundreds of layers, that's where the term "deep" comes from. You can build one of these deep networks using only weight matrices as we did in the previous notebook, but in general it's very cumbersome and difficult to implement. Py... | github_jupyter |
### Netflix Scrapper
The purpose of the code is to get details of all the Categories on Netflix and then to gather information about Sub-Categories and movies under each Sub-Category.
```
from bs4 import BeautifulSoup
import requests
import pandas as pd
import numpy as np
def make_soup(url):
return BeautifulSoup(... | github_jupyter |
# Tidy datasets are easy to manipulate, model and visualise, and have a specific structure: each variable is a column, each observation is a row, and each type of observational unit is a table (3rd level normalization of relational database).
### Tidy Data, Hadley Wickham (2014)
```
# This statement widens the notebo... | github_jupyter |
# Explain Attacking BERT models using CAptum
Captum is a PyTorch library to explain neural networks
Here we show a minimal example using Captum to explain BERT models from TextAttack
[](https://colab.research.google.com/github/QData/TextAttack/... | github_jupyter |
## Advanced Lane Finding Project
The goals / steps of this project are the following:
* Compute the camera calibration matrix and distortion coefficients given a set of chessboard images.
* Apply a distortion correction to raw images.
* Use color transforms, gradients, etc., to create a thresholded binary image.
* Ap... | github_jupyter |
```
import pandas as pd
import datetime
import vk_api
import os
import requests
import json
import random
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import sys
token = '4e6e771d37dbcbcfcc3b53d291a274d3ae21560a2e81f058a7c177aff044b5141941e89aff1fead50be4f'
vk_session = vk_api.VkApi(token=t... | github_jupyter |
# Hello, Slicer!
Let's test that the setup was successful by checking that:
1. We're running the python kernel bundled with Slicer
2. The python kernel actually works
3. We have access to Slicer functionality
```
import sys
print(f'We\'re running {sys.executable}\n')
print("Hello, Slicer!")
try:
import vtk
i... | github_jupyter |
##### 1

##### 2

##### 3

##### 4

##### 5
:
dealerIDir = glob.glob(directory+'/*')
allVidir = []
for i in rang... | github_jupyter |
# Software Analytics Mini Tutorial Part I: Jupyter Notebook and Python basics
## Introduction
This series of notebooks are a simple mini tutorial to introduce you to the basic functionality of Jupyter, Python, pandas and matplotlib. The comprehensive explanations should guide you to be able to analyze software data on... | github_jupyter |
```
## plot the histogram showing the modeled and labeled result
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
# for loop version
def read_comp(file):
Pwave = {}
Pwave['correct'] = []
Pwave['wrongphase'] = []
Pwave['miss'] = 0
Pwave['multiphase'] = [] ... | github_jupyter |
<img src="aiayn.png">
> When teaching, I emphasize implementation as a way to understand recent developments in ML. This post is an attempt to keep myself honest along this goal. The recent ["Attention is All You Need"]
(https://arxiv.org/abs/1706.03762) paper from NIPS 2017 has been instantly impactful paper as a new... | github_jupyter |
# COVID and Ontario Licensed Child Care
```
import pandas as pd
import datetime
import io
from io import StringIO
import os
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
%matplotlib inline
# import naming conventions
import numpy as np
import matplotlib.pyplot as plt
url = 'https://... | github_jupyter |
```
%matplotlib inline
```
torchaudio Tutorial
===================
PyTorch is an open source deep learning platform that provides a
seamless path from research prototyping to production deployment with
GPU support.
Significant effort in solving machine learning problems goes into data
preparation. ``torchaudio`` le... | github_jupyter |
```
import numpy as np
import pandas as pd
from pandas.io.json import json_normalize
from IPython.core.display import display, HTML
import locale
locale.setlocale(locale.LC_ALL, 'en_US')
from concurrent.futures import ProcessPoolExecutor
import multiprocessing
from tqdm import tqdm_notebook as tqdm
timeout = 3600 #... | github_jupyter |
### 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 pandas as pd
# File to Load (Remember to Change These)
file_to_load = "purchase_data.csv"
# Read Purchasing File and stor... | github_jupyter |
# EEP/IAS 118 - Section 6
## Fixed Effects Regression
### August 1, 2019
Today we will practice with fixed effects regressions in __R__. We have two different ways to estimate the model, and we will see how to do both and the situations in which we might favor one versus the other.
Let's give this a try using the d... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.