text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# Scale Detection
Train a model to detect the scale of an image relative to the scale of the training dataset for a model.
```
import os
import errno
import numpy as np
import deepcell
# Set up some global constants and shared filepaths
SEED = 123 # random seed for splitting data into train/test
ROOT_DIR = '/data... | github_jupyter |
## What's this TensorFlow business?
You've written a lot of code in this assignment to provide a whole host of neural network functionality. Dropout, Batch Norm, and 2D convolutions are some of the workhorses of deep learning in computer vision. You've also worked hard to make your code efficient and vectorized.
For ... | github_jupyter |
# Evaluate
```
import logging
import regex
import unicodecsv as csv
import lemmy
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.DEBUG)
NORMS_FILE = "./data/norms.csv"
UD_TRAIN_FILE = "./data/UD_Danish/da-ud-train.conllu"
UD_DEV_FILE = "./data/UD_Danish/da-ud-dev.conllu"
```
We read the normal... | github_jupyter |
## Lesson 2 - Basic Data Structure
* 2.1 - List
* 2.2 - Index and Slice
* 2.3 - Common Methods of List Object
* 2.4 - List Sort
* 2.5 - Other List Operations
* 2.6 - Multiple Layers List and DeepCopy
* 2.7 - Tuple
* 2.8 - Set
In this section, we focus on discussing the basic data structure in Python: **List**, **Tupl... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import plotly.express as px
data = pd.read_csv('https://raw.githubusercontent.com/PacktWorkshops/The-Data-Analysis-Workshop/master/Chapter09/Datasets/energydata_complete.csv')
data.head()
data.isnull().sum()
df1 = data.rena... | github_jupyter |
```
# Module import
from IPython.display import Image
import sys
import pandas as pd
# To use interact -- IPython widget
from __future__ import print_function
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
# append to path the folder that contains the analytic scann... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import xarray as xr
ds = xr.open_dataset('/scratch/05488/tg847872/fluxbypass_aqua/AndKua_aqua_SPCAM3.0_sp_fbp_f4.cam2.h1.0001-01-09-00000.nc',
decode_times=False)
dsp4 = xr.open_dataset('/scratch/05488/tg847872/debug/AndKua_aq... | github_jupyter |
This tutorial was implemented on Macbook pro (15-inch, 2018)
# Simulate scRNA-seq data
```
rm(list = ls())
library(splatter)
library(rhdf5)
i <- 1 ## set random seed
simulate <- function(nGroups=3, nGenes=2500, batchCells=1500, dropout=0) # change dropout to simulate various dropout rates
{
if (nGroups > 1) me... | github_jupyter |
# Prior Sensitivity Analysis
When we don't have strong beliefs about our prior, we should choose uninformative priors. In order to show that the priors don't matter, it is better to verify that the model returns similar results using a variety of priors, that way we know that the model is dependent on the data rather ... | github_jupyter |
<a href="https://colab.research.google.com/github/tensorflow/tpu/blob/master/tools/colab/mnist_estimator.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
##### Copyright 2018 The TensorFlow Hub Authors.
Licensed under the Apache License, Version 2.0... | github_jupyter |
## These are the follow-up code samples for the following blog post: [Pandas DataFrame by Example](http://queirozf.com/entries/pandas-dataframe-by-example)
```
import pandas as pd
import numpy as np
pd.__version__
df = pd.DataFrame({
'name':['john','mary','peter','jeff','bill','lisa'],
'age':[23,78,22,19,45,33... | github_jupyter |
# Perceptron with Pytorch
#### Luca Laringe
In this notebook, I will show a basic implementation of a perceptron using Pytorch.
A perceptron is a single layer neural network, it is maily used for classification purposes. More info at https://en.wikipedia.org/wiki/Perceptron.
## Data
In this section I am going to gen... | github_jupyter |
# Table of Contents
<p><div class="lev1 toc-item"><a href="#Setup" data-toc-modified-id="Setup-1"><span class="toc-item-num">1 </span>Setup</a></div><div class="lev1 toc-item"><a href="#Semantics" data-toc-modified-id="Semantics-2"><span class="toc-item-num">2 </span>Semantics</a></div><div class... | github_jupyter |
## SQLite
Embora a biblioteca Pandas seja a indica para o tratamento da maior parte das situações, por vezes torna-se necessário a utilização de bases de dados e das operações associadas às bases de dados.
Um dos motores de bases de dados disponíveis para pequenas implementações é o SQLite, cuja utilização se mostra ... | github_jupyter |
Now that we've built & trained logistic regression and decision tree models to classify the iris dataset in these previous posts:
- [LINK TO LOGISTIC REGRESSION POST]
- [LINK TO DECISION TREE POST]
We found that they were both really good in their own regard (potentially overfitting), but what if we had two models th... | github_jupyter |
# Multipe Regression
In this notebook we will learn the respective steps needed to compute Simple Linear Regression with data on house sales in King County, USA (https://www.kingcounty.gov) to predict house prices. You will:
* Upload and preprocess the data
* Write a function to compute the Multiple Regression weights... | github_jupyter |
```
import tensorflow as tf
import re
import numpy as np
import pandas as pd
from tqdm import tqdm
import collections
import itertools
from unidecode import unidecode
import malaya
import re
import json
def build_dataset(words, n_words, atleast=2):
count = [['PAD', 0], ['GO', 1], ['EOS', 2], ['UNK', 3]]
counter... | github_jupyter |
Центр непрерывного образования
# Программа «Python для автоматизации и анализа данных»
Неделя 1 - 1
*Татьяна Рогович, НИУ ВШЭ*
*Алла Тамбовцева, НИУ ВШЭ*
## Строки. Ввод и форматирование.
**ТЕКСТ (СТРОКИ) (STR, STRING):** любой текст внутри одинарных или двойных кавычек.
Важно: целое число в кавычках - это тоже... | github_jupyter |
<div id="image">
<img src="https://www.imt-atlantique.fr/sites/default/files/logo_mt_0_0.png" WIDTH=280 HEIGHT=280>
</div>
<div id="subject">
<CENTER>
</br>
<font size="4"></br> UE Artificial Inteligence: Project 2</font></br></div>
</CENTER>
<CENTER>
<font size="4"></br>April 2019</font></br></div>
</CENTER>
<CENTER>
... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import logging
import pandas as pd
import numpy as np
from kernel_wasserstein_flows.gradient_flow import gradient_flow
from kernel_wasserstein_flows.utils import generate_XY_mog_square
from kernel_wasserstein_flows.kernels import gaussian_kernel
from kernel_wasserstein_flows.conf... | github_jupyter |
## Truc Huynh
- 1/11/2022
- 7:58 PM
- Workshop turn it in
# Workshop 1
This notebook will cover the following topics:
1. Basic Input/Output and formatting
2. Decision Structure and Boolean Logic
3. Basic Loop Structures
4. Data Structures
## 1.1 Basic Input/Output and formatting (Follow):
**Learning Objectives:... | github_jupyter |
### Dependences
```
import sys
sys.path.append("../")
import math
from tqdm import tqdm
import numpy as np
import tensorflow as tf
from PIL import Image
from tqdm import tqdm
import matplotlib.pyplot as plt
from IPython.display import clear_output
from lib.models.LinkNet import LinkNet
import lib.utils as utils
i... | github_jupyter |
# Evaluation with JustCause
In this notebook, we examplify how to use JustCause in order to evaluate methods using reference datasets. For simplicity, we only use one dataset, but show how evaluation works with multiple methods. Both standard causal methods implemented in the framework as well as custom methods.
## C... | github_jupyter |
# README
# Ref
- https://www.ieee-security.org/TC/SPW2019/DLS/doc/06-Marin.pdf
- https://www.stratosphereips.org/datasets-normal
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
%precision 4
%reload_ext autoreload
import re
import sys
import math
import random
import datetime
import numpy as np
from matp... | github_jupyter |
This notebook walks you through on how to get a geojson shape plotted in a 2.5D view, with an overlayed satellite image on top. <br/>
For this, besides the notebook you will need this github project:<br/>
https://github.com/zhunor/threejs-dem-visualizer <br/>
It has to be cloned IN the same folder as this notebook. Aft... | github_jupyter |
*Donald Knuth: "Premature optimization is the root of all evil"*
**Оригинал**: https://ipython-books.github.io/chapter-5-high-performance-computing/
- Компиляция [Just-In-Time (JIT)](https://ru.wikipedia.org/wiki/JIT-%D0%BA%D0%BE%D0%BC%D0%BF%D0%B8%D0%BB%D1%8F%D1%86%D0%B8%D1%8F) кода Python.
- Использование языка боле... | github_jupyter |
# Preamble
## Guide for Students and Readers
This is a different sort of book (indeed, we're a bit doubtful about calling it a "book", even), intended for a different sort of course. The content is intended to be outside the normal mathematics curriculum. The book won't teach calculus or linear algebra, for example, a... | github_jupyter |
# Getting Started with simple pandas
Here I reproduced some of the operation that appeared in *Python for Data Analysis*.
Hope this could help you get familiar with simple pandas
Also, since there is no good visualization for simple pandas right now, I have transfered each of the results to pandas.
```
import spand... | github_jupyter |
<a href="https://colab.research.google.com/github/shahd1995913/Tahalf-Mechine-Learning-DS3/blob/main/Tasks/polynomial_regression.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
## Problem 1: Polynomial Regression
---
You want to buy huge amount of... | github_jupyter |
```
# from google.colab import drive
# drive.mount('/content/drive')
import torch.nn as nn
import torch.nn.functional as F
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import Dataset, DataLoader... | github_jupyter |
# <img style="float: left; padding-right: 10px; width: 45px" src="https://raw.githubusercontent.com/Harvard-IACS/2018-CS109A/master/content/styles/iacs.png"> CS109B Data Science 2: Advanced Topics in Data Science
## Lecture 21: Adversarial Examples
**Harvard University**<br/>
**Spring 2019**<br/>
**Instructors:**... | github_jupyter |
# SMA ROC Portfolio
1. The Security is above its 200-day moving average
2. The Security closes with sma_roc > 0, buy.
3. If the Security closes with sma_roc < 0, sell your long position.
(For a Portfolio of securities.)
```
import datetime
import matplotlib.pyplot as plt
import pandas as pd
from... | github_jupyter |
# Using GraphiPy to extract data from Tumblr
```
from graphipy.graphipy import GraphiPy
# create GraphiPy object (default to Pandas)
graphipy = GraphiPy()
```
# Creating the Tumblr Object
GraphiPy's Tumblr object needs CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, and OAUTH_SECRET in order to connect to Tumblr's API:
... | github_jupyter |
```
import numpy as np
import pandas as pd
import os
from IPython.core.display import display, HTML, clear_output
display(HTML("<style>.container { width:80% !important; }</style>"))
from scipy.sparse import csc_matrix
from sparsesvd import sparsesvd
```
# Import ratings data (including user data)
```
cwd = os.getcwd... | github_jupyter |
## Scope
This notebook goes through how to create a training set from a set of questions and answers
## Optional: further research
* **OOB for cleaning text SpaCy** https://towardsdatascience.com/machine-learning-for-text-classification-using-spacy-in-python-b276b4051a49
* 1) BLUE SCORE FOR EVALUATION: https://machin... | github_jupyter |
Some rough fits to the sky surface brightness to use as inputs in the simulated spectra
```
import os
import h5py
import numpy as np
from scipy.optimize import curve_fit
import astropy.units as u
from feasibgs import util as UT
import desimodel.io
import desisim.simexp
import matplotlib as mpl
import matplotlib.py... | github_jupyter |
```
import numpy as np
from sklearn.datasets.samples_generator import make_blobs
import pandas as pd
import matplotlib.pyplot as plt
%%markdown
# k-means
samples = np.array([[1,2], [12,2], [0,1], [10,0], [9,1], \
[8,2], [0,10], [1,8], [2,9], [9,9], \
[10,8], [8,9] ], dtype = np.f... | github_jupyter |
# Serialization - saving, loading and checkpointing
At this point we've already covered quite a lot of ground.
We know how to manipulate data and labels.
We know how to construct flexible models capable of expressing plausible hypotheses.
We know how to fit those models to our dataset.
We know of loss functions to us... | github_jupyter |
**Math - Linear Algebra**
*Linear Algebra is the branch of mathematics that studies [vector spaces](https://en.wikipedia.org/wiki/Vector_space) and linear transformations between vector spaces, such as rotating a shape, scaling it up or down, translating it (ie. moving it), etc.*
*Machine Learning relies heavily on L... | github_jupyter |
# Random forest classification
## RAPIDS single GPU
<img src="https://rapids.ai/assets/images/RAPIDS-logo-purple.svg" width="400">
```
import os
```
# Load data and feature engineering
Load a full month for this exercise. Note we are loading the data with RAPIDS now (`cudf.read_csv` vs. `pd.read_csv`)
```
!nvidia... | github_jupyter |
TSG023 - Get all BDC objects (Kubernetes)
=========================================
Description
-----------
Get a summary of all Kubernetes resources for the system namespace and
the Big Data Cluster namespace
Steps
-----
### Common functions
Define helper functions used in this notebook.
```
# Define `run` funct... | github_jupyter |
<img alt="QuantRocket logo" src="https://www.quantrocket.com/assets/img/notebook-header-logo.png">
© Copyright Quantopian Inc.<br>
© Modifications Copyright QuantRocket LLC<br>
Licensed under the [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/legalcode).
<a href="https://www.quantrocke... | github_jupyter |
# Sentiment analysis using IMDB dataset
```
import numpy as np
from glob import glob
import os
import matplotlib.pyplot as plt
from sklearn import svm
import zipfile
from tqdm import tqdm
from nltk.tokenize import word_tokenize
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text i... | github_jupyter |
```
#default_exp callback.training
```
# Training Callbacks
> Callbacks to help during training, including `fit_one_cycle`, the LR Finder, and hyper-parameter scheduling
```
#export
# Contains code used/modified by fastai_minima author from fastai
# Copyright 2019 the fast.ai team.
#
# Licensed under the Apache Licen... | github_jupyter |
# <img src="https://img.icons8.com/bubbles/100/000000/3d-glasses.png" style="height:50px;display:inline"> EE 046746 - Technion - Computer Vision
#### Elias Nehme
## Tutorial 14 - Deep Computational Imaging
---
<img src="./assets/tut_14_teaser.gif" style="width:800px">
* <a href="https://www.nature.com/articles/s4137... | github_jupyter |
# Transfer Learning
In this notebook, you'll learn how to use pre-trained networks to solved challenging problems in computer vision. Specifically, you'll use networks trained on [ImageNet](http://www.image-net.org/) [available from torchvision](http://pytorch.org/docs/0.3.0/torchvision/models.html).
ImageNet is a m... | github_jupyter |
[](http://rpi.analyticsdojo.com)
<center><h1>Introduction to Python - Kaggle Baseline</h1></center>
<center><h3><a href = 'http://rpi.analyticsdojo.com'>rpi.analyticsdojo.com</a></h3></center>
# Kaggle Ba... | github_jupyter |
### Set Data Path
```
from pathlib import Path
base_dir = Path("data")
train_dir = base_dir/Path("train")
validation_dir = base_dir/Path("validation")
test_dir = base_dir/Path("test")
```
### Image Transform Function
```
from torchvision import transforms
transform = transforms.Compose([
transforms.Resize((22... | github_jupyter |
GONG PFSS extrapolation
=======================
Calculating PFSS solution for a GONG synoptic magnetic field map.
First, import required modules
```
import astropy.constants as const
import astropy.units as u
from astropy.coordinates import SkyCoord
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import A... | github_jupyter |
# Synthesis with a configuration file
Perhaps the simplest approach to Hazel is to use configuration files. In this notebook we show how to use a configuration file to run Hazel in different situations.
## Single pixel synthesis
```
%matplotlib inline
import numpy as np
import matplotlib.pyplot as pl
import hazel
im... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#argument 'thousands=','' avoids that comma is kept in numeric values
dataset_train = pd.read_csv('Google_Price_Train_2012-2016.csv', thousands=',')
#select just the Close column
dataset_train_close = dataset_train['Close']
#change datatype o... | github_jupyter |
## Example for class imbalance
The dataset used in this notebook is of '[IEEE-CIS Fraud Detection](https://www.kaggle.com/c/ieee-fraud-detection/data)'. This notebook will introduce you to class imbalance problem.
Data set link: [Fraud Dataset](https://drive.google.com/file/d/1q8SYcjOJULdSkETv5S_gd7xNq1GrBHAO/view)
... | github_jupyter |
# Detecting and mitigating age bias on credit decisions
The goal of this tutorial is to introduce the basic functionality of AI Fairness 360.
### Biases and Machine Learning
A machine learning model makes predictions of an outcome for a particular instance. (Given an instance of a loan application, predict if the ap... | github_jupyter |
```
import pandas as pd
# Read .csv file of total schools and grades from Florida Department of Education
file = "./SchoolGrades19_clean.csv"
school_grades = pd.read_csv(file)
# Read file with school zip code info
file2 = "./hills_schools_zip.csv"
school_zip = pd.read_csv(file2)
pd.set_option('display.max_columns', N... | github_jupyter |
# Lab 05 : Final code -- demo
```
# For Google Colaboratory
import sys, os
if 'google.colab' in sys.modules:
# mount google drive
from google.colab import drive
drive.mount('/content/gdrive')
# find automatically the path of the folder containing "file_name" :
file_name = 'final_demo.ipynb'
imp... | github_jupyter |
# SVI Part III: ELBO Gradient Estimators
## Setup
We've defined a Pyro model with observations ${\bf x}$ and latents ${\bf z}$ of the form $p_{\theta}({\bf x}, {\bf z}) = p_{\theta}({\bf x}|{\bf z}) p_{\theta}({\bf z})$. We've also defined a Pyro guide (i.e. a variational distribution) of the form $q_{\phi}({\bf z})$... | github_jupyter |
# Scientific Computing with Python (Second Edition)
# Chapter 12
This notebook file requires Jupyter notebook version >= 5 as it uses cell tagging to avoid that execution stops when intentionally exceptions are raises in a a cell.
*We start by importing all from Numpy. As explained in Chapter 01
the examples are wr... | github_jupyter |
# Rough draft of getting _vcf_ files
### Overview
Different tertiary analysis software often works with _vcf_ or _gene expression_ files. Depending on the API they use, you may want to _point to the actual file_ **or** accept _an http download link_. We are going to show both approaches here, but adding a download step... | github_jupyter |
####################################
# Our early approaches of producing test heat-events-dataset
####################################
```
from matplotlib import pyplot as plt
import matplotlib.dates as mdates
from matplotlib.patches import Rectangle
from datetime import datetime, timedelta
import numpy as np
import ... | github_jupyter |
# Inferring prompt types
This notebook demos two transformers, which broadly aim at producing abstract representations of an utterance in terms of its phrasing and its rhetorical intent:
* The `PhrasingMotifs` transformer extracts representations of utterances in terms of how they are phrased;
* The `PromptTypes` tr... | github_jupyter |
```
from IPython.display import YouTubeVideo
YouTubeVideo('W-ZsWqcl1_c')
```
# 如何使用和开发微信聊天机器人的系列教程
# A workshop to develop & use an intelligent and interactive chat-bot in WeChat
### WeChat is a popular social media app, which has more than 800 million monthly active users.
<img src='http://www.kudosdata.com/wp-cont... | github_jupyter |
<span style="color:#8735fb; font-size:22pt"> **Demo Overview** </span>
Automated Model Tuning (AMT) also known as Hyper-Parameter Optimization (HPO) helps to find the best version of a model by exploring the space of possible configurations. While generally desirable, this search is computationally expensive and can ... | github_jupyter |
# Experimental Features
Here are some examples of experimental features we're planning to add to our API. These wrappers abstract away some parts of the protobuf structs, and provide easier access to geometries and `datetime`.
## First Code Example
This is an alternative to the original version [here](./README.md#firs... | github_jupyter |
## Dataset: Labeled Faces in the Wild ##
## Experiment: (experiment_1) Image based gender classification ##
```
import torch
import torchvision
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
import torch.optim as optim
from torchvision import transforms
import torch.nn.functional as F
from torc... | github_jupyter |
Deep Learning Models -- A collection of various deep learning architectures, models, and tips for TensorFlow and PyTorch in Jupyter Notebooks.
- Author: Sebastian Raschka
- GitHub Repository: https://github.com/rasbt/deeplearning-models
# Model Zoo -- Simple RNN
Demo of a simple RNN for sentiment classification (here... | github_jupyter |
##### Copyright 2018 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 |
# Gradient Checking
Welcome to the final assignment for this week! In this assignment you will learn to implement and use gradient checking.
You are part of a team working to make mobile payments available globally, and are asked to build a deep learning model to detect fraud--whenever someone makes a payment, you w... | github_jupyter |
```
# Imports needed for this exercice
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import hcipy as hc # get at https://docs.hcipy.org/0.4.0/
# You might need those later on in the class
# import os
# import exoscene.image
# import exoscene.star
# import exoscene.planet
# from exoscene.planet... | github_jupyter |
# SQL Queries 01
For more SQL examples in the SQLite3 dialect, seee [SQLite3 tutorial](https://www.techonthenet.com/sqlite/index.php).
For a deep dive, see [SQL Queries for Mere Mortals](https://www.amazon.com/SQL-Queries-Mere-Mortals-Hands/dp/0134858336/ref=dp_ob_title_bk).
## Data
```
%load_ext sql
%sql sqlite:... | github_jupyter |
# Reminder
<a href="#/slide-1-0" class="navigate-right" style="background-color:blue;color:white;padding:10px;margin:2px;font-weight:bold;">Continue with the lesson</a>
<font size="+1">
By continuing with this lesson you are granting your permission to take part in this research study for the Hour of Cyberinfrastru... | github_jupyter |
<img src='https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2020/10/11/p1.png'>
```
# 初始状态mask里面的1代表这次选的所有node,然后BFS尝试把所有node连在一起,每连一个node,就把1设置成0
from collections import defaultdict, deque
class Solution:
def countSubgraphsForEachDiameter(self, n: int, edges):
graph = defaultdict(list)
for ... | github_jupyter |
```
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from unidecode import unidecode
import re
def cleaning(string):
string = unidecode(string)
string = re.sub(r'\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*(?:(?:\/[^\s/]*))*', '', string)
string = re.sub(r'[ ]+', ' ', string).strip().split()
string... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
# Setup
%matplotlib inline
```
# Load some house value vs. crime rate data
Dataset is from Philadelphia, PA and includes average house sales price in a number of neighborhoods. The attributes of each neighborho... | github_jupyter |
# Comparing Russell Westbrook and Oscar Robertson's Triple Double Seasons
### Author: Rohan Patel
NBA player Russell Westbrook who plays for the Oklahoma City Thunder just finished an historic NBA basketball season as he became the second basketball player in NBA history to average a triple double for an entire seaso... | github_jupyter |
## Loading dataset
```
from beta_rec.datasets.movielens import Movielens_100k
from beta_rec.data import BaseData
dataset = Movielens_100k()
split_dataset = dataset.load_leave_one_out(n_test=1)
data = BaseData(split_dataset)
```
### Model config
```
config = {
"config_file":"../configs/mf_default.json"
}
# the '... | github_jupyter |
First, run the command to get the embeddings of the upcoming weeks. We also note this model (to get the embeddings as well as one first model to learn the embeddings). This model will then be used to genereate embeddings for all upcoming weeks.
```
day = 20160701
! export CUDA_VISIBLE_DEVICES=3 && python main.py --da... | github_jupyter |
# Part III: Tradeoffs
In this notebook, we'll explore the pros and cons of a few variations of the Babble Labble framework.
1. Data Programming or Majority Vote
2. Explanations or Traditional Labels
3. Including LFs as features
As with all machine learning tools, no one tool fits all situations; there are always tra... | github_jupyter |
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAADhCAYAAAC+/w30AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH4wEeDgYF/Qy0kwAAIABJREFUeNrsnXl4G9W5/z8zWrxNHDt29j0kBEgQMYQdwtqW0CKgtHS5XShtb1vfbrSltOpduro/StfbW3VvaaG0QEtApQ1Q9n1JIlDCEkL23fES2+NFsjTz++MckUHYia0ZW5J9vs+jR7JkHc3MOXPe77uDgoKCgoKC... | github_jupyter |
##### Copyright 2020 The EvoFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 & Creative Common licence 4.0
# EvoFlow and its tutorials are released under the Apache 2.0 licence
# its documentaton is licensed under the Creative Common licence 4.0
```
# Visualization callback setup
As seen abov... | github_jupyter |
<h1><font size=12>
Weather Derivatites </h1>
<h1> Rainfall Simulator -- Full modeling <br></h1>
Developed by [Jesus Solano](mailto:ja.solano588@uniandes.edu.co) <br>
16 September 2018
```
# Import needed libraries.
import numpy as np
import pandas as pd
import random as rand
import matplotlib.pyplot as plt
from sc... | github_jupyter |
# *CoNNear*: A convolutional neural-network model of human cochlear mechanics and filter tuning for real-time applications
Python notebook for reproducing the evaluation results of the proposed CoNNear model.
## Prerequisites
- First, let us compile the cochlea_utils.c file that is used for solving the transmission ... | github_jupyter |
```
import torch.nn as nn
import torch.nn.functional as F
import pandas as pd
import numpy as np
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import torch.optim as optim
from matplotlib import pyp... | github_jupyter |
# Lung Segmentation - Montgomery Dataset
```
%reload_ext autoreload
%autoreload 2
import os
import tempfile
import tensorflow as tf
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import cv2
from tensorflow.keras.models import load_model
import fastestimator as fe
from fastestimator.architecture... | github_jupyter |
```
import pandas as pd
import numpy as np
from itertools import combinations
from catboost import CatBoostClassifier, CatBoostRegressor
from sklearn.model_selection import train_test_split, KFold
from sklearn.metrics import mean_squared_error, accuracy_score, recall_score, precision_score, f1_score, roc_auc_score
impo... | github_jupyter |
# MARATONA BEHIND THE CODE 2021
## DESAFIO 2: QUANAM
##### Autor: Rodrigo Oliveira
##### LinkedIn: https://www.linkedin.com/in/rodrigolima82/
- `"ID":` número identificador da amostra
- `"ILLUM":` iluminação
- `"HUMID":` humidade
- `"CO2":` CO2
- `"SOUND":` som
- `"TEMP":` temperatura
- `"RYTHM":` ritmo cardíaco
# ... | github_jupyter |
```
from pyspark.mllib.linalg import SparseVector
from pyspark.mllib.linalg.distributed import RowMatrix
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
import time
from collections import defaultdict
from pyspark.sql import functions as sfunc
from pyspark.sql import types as stypes
import mat... | github_jupyter |
[View in Colaboratory](https://colab.research.google.com/github/findingfoot/ML_practice-codes/blob/master/Lasso_and_Ridge_regression.ipynb)
```
import warnings
warnings.filterwarnings('ignore')
import sys
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn import datasets
from tenso... | github_jupyter |
# Datashading LandSat8 raster satellite imagery
Datashader is fundamentally a rasterizing library, turning data into rasters (image-like arrays), but it is also useful for already-rasterized data like satellite imagery. For raster data, datashader uses the separate [xarray](http://xarray.pydata.org/) library to re-re... | github_jupyter |
## Linear regression using PyTorch built-ins
```
import torch.nn as nn
import numpy as np
import torch
# Input (temp, rainfall, humidity)
inputs = np.array([[73, 67, 43], [91, 88, 64], [87, 134, 58],
[102, 43, 37], [69, 96, 70], [73, 67, 43],
[91, 88, 64], [87, 134, 58], [102, 4... | github_jupyter |
```
from PIL import Image, ImageDraw, ImageFont, ImageFilter, ImageChops
import pandas as pd
import numpy as np
import pathlib
import os
from fontTools.ttLib import TTFont
from fontTools.unicode import Unicode
characters = ['1','2','3','4','5','6','7','8','9']
IMG_WIDTH = 100
IMG_HEIGHT = 100
count = 0
def drawCharacte... | github_jupyter |
```
import urllib
import pandas as pd
import numpy as np
import dask.dataframe as dd
import dask.bag as db
import dask.diagnostics as dg
# Determine which stations we need
# {column name:extents of the fixed-width fields}
columns = {"ID": (0,11), "LATITUDE": (12, 20), "LONGITUDE": (21, 30), "ELEVATION": (31, 37),"S... | github_jupyter |
# Arvo to PostgreSQL
## Generating a fully-functional CSV. (Err... repairing)
When my database processing script ran and saved as CSV something happened and corrupted the CSV.
As a result it only contained 44,000 rows.
Luckily I also saved a version as a .avro file.
Here's the steps I took to make this work.
*... | github_jupyter |
# Ejemplos de programas en Python
Veamos aquí algunos ejemplos de Python.
## Números de Fibonacci
Los numéros de Fibonacci siguen una secuencia de números enteros y se caracterizan porque cada número en la secuencia (después de los primeros dos números) son la suma de los dos numeros precedentes ($x_n = x_{n-1} + x_... | github_jupyter |
```
%matplotlib inline
```
# Overview
**This code is for analyzing patterns of the different weight files which should have already been computed**
**Basic imports here**
```
import numpy as np
import glob
from scipy import stats
from matplotlib import pyplot as plt
```
**Just some details for making prettier plo... | github_jupyter |
# 1D Kalman Filter
Now, you're ready to implement a 1D Kalman Filter by putting all these steps together. Let's take the case of a robot that moves through the world. As a robot moves through the world it locates itself by performing a cycle of:
1. sensing and performing a measurement update and
2. moving and performi... | github_jupyter |
# Principal Component Analysis with Intel® Data Analytics Acceleration Library in Amazon SageMaker
## Introduction
Intel® Data Analytics Acceleration Library (Intel® DAAL) is the library of Intel® architecture optimized building blocks covering all stages of data analytics: data acquisition from a data source, prepro... | github_jupyter |
# Тест. Доверительные интервалы для долей
```
import numpy as np
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
```
Большая часть млекопитающих неспособны во взрослом возрасте переваривать лактозу, содержащуюся в молоке. У людей за расщепление лактозы отвеч... | github_jupyter |
<a href="https://colab.research.google.com/github/parekhakhil/pyImageSearch/blob/main/1403_multi_template_matching.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
![logo_jupyter.png](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAABcCAYAAABA4uO3... | github_jupyter |
This is a jupyter notebook to get the graphs from geo maps.
```
import random
import os
import numpy as np
import networkx as nx
import geopandas as gpd
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
from matplotlib.collections import PatchCollection
# Load the box module from shapely to... | github_jupyter |
```
%matplotlib inline
```
# Post pruning decision trees with cost complexity pruning
.. currentmodule:: sklearn.tree
The :class:`DecisionTreeClassifier` provides parameters such as
``min_samples_leaf`` and ``max_depth`` to prevent a tree from overfiting. Cost
complexity pruning provides another option to control ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.