text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# NearestCentroid with MaxAbsScaler and QuantileTransformer
This Code template is for the Classification task using a simple NearestCentroid and data rescaling technique MaxAbsScaler and feature transformation QuantileTransformer in a pipeline.
### Required Packages
```
import warnings
import numpy as np
import pa... | github_jupyter |
# Spatial Analysis
<br>
### Imports
```
import pandas as pd
import geopandas as gpd
import requests
import warnings
import matplotlib.pyplot as plt
def df_to_gdf(
df: pd.DataFrame,
crs: str='EPSG:4326',
lat_col: str='Latitude',
lon_col: str='Longitude'
):
with warnings.catch_warnings():
... | github_jupyter |
<img src="fig/scikit-hep-logo.svg" style="height: 200px; margin-left: auto; margin-bottom: -75px">
# Scikit-HEP tutorial for the STAR collaboration
This notebook shows you how to do physics analysis in Python using Scikit-HEP tools: Uproot, Awkward Array, Vector, hist, etc., and it uses a STAR PicoDST file as an exam... | github_jupyter |
```
!jupyter nbconvert eesardocs.ipynb --to slides --post serve
import warnings
# these are innocuous but irritating
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
```
# Change Detection with Sentinel-1 PolSAR imagery on the G... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```
# Today's data
400 fotos of human faces. Each face is a 2d array [64x64] of pixel brightness.
```
from sklearn.datasets import fetch_olivetti_faces
data = fetch_olivetti_faces().images
# @this code showcases matplotlib subplots. The synta... | github_jupyter |
# Creating a Sentiment Analysis Web App
## Using PyTorch and SageMaker
_Deep Learning Nanodegree Program | Deployment_
---
Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from scipy.optimize import minimize_scalar, minimize
from time import time
import seaborn as sns
sns.set_style('darkgrid')
sns.set_context('paper')
import sys
sys.path.append('..')
from osd import Problem
from osd.components import GaussNoi... | github_jupyter |
# Swish-based classifier
- Swish activation, 4 layers, 100 neurons per layer
- Validation score use ensemble of 10 models weighted by loss
### Import modules
```
%matplotlib inline
from __future__ import division
import sys
import os
sys.path.append('../')
from Modules.Basics import *
from Modules.Class_Basics import... | github_jupyter |
# Replication - High Dimensional Case2 - Table
Here we provide a notebook to replicate the summary tables for the high-dimensional case simulation.
The notebook replicates the results in:
- /out/simulation/tables/sim_hd2*
The main script can be found at:
- /scripts/simulation/tables/highdimensional_case2.py
## Pl... | github_jupyter |
# Jacobi Method
From: https://en.wikipedia.org/wiki/Jacobi_method :
#### Jacobi Method
In numerical linear algebra, the Jacobi method is an iterative algorithm for determining the solutions of a diagonally dominant system of linear equations.
<br>
<br>
#### Convergence
A sufficient (but not necessary) condition for th... | github_jupyter |
# deep-muse (ver 0.8) [WIP]
***
# Advanced text-to-music generator
***
## Inspired by https://github.com/lucidrains/deep-daze
## Powered by tegridy-tools TMIDI Optimus Processors
***
### Project Los Angeles
### Tegridy Code 2021
***
# Setup environment
```
#@title Install dependencies
!git clone https://githu... | github_jupyter |
(Real_Non_Linear_Neural_Network)=
# Chapter 7 -- Real (Non-linear) Neural Network
So in the previous example, we derived the gradients for a two layers neural network. This is to find the straight line that bisects the two groups in figure 7.1 in the introduction. However, in reality, we often have the following group... | github_jupyter |
* By: Proskurin Oleksandr
* Email: proskurinolexandr@gmail.com
* Reference: Advances in Financial Machine Learning, Marcos Lopez De Prado, pg 30, https://towardsdatascience.com/financial-machine-learning-part-0-bars-745897d4e4ba
```
from IPython.display import Image
```
# Imbalance bars generation algorithm
Let's... | github_jupyter |
```
from transformers import T5Tokenizer, T5ForConditionalGeneration
from utils_accelerate import *
tokenizer = T5Tokenizer.from_pretrained('t5-small')
# input = "predict tail: barack obama | position_held |"
# input = "translate English to German: How are you doing?"
# model = T5ForConditionalGeneration.from_pretrai... | github_jupyter |
```
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
```
# Linear models
Linear models are useful when little data is available or for very large feature spaces as in text classification. In addition, they form a good case study for regularization.
# Linear models for regression
All linear mod... | github_jupyter |
# Which citation styles do we have in Crossref data?
Dominika Tkaczyk
16.11.2018
In this notebook I use the style classifier to find out which styles are present in the Crossref collection.
```
import sys
sys.path.append('..')
%matplotlib inline
import warnings
warnings.simplefilter('ignore')
import json
import ... | github_jupyter |
# Accessing System Configurations With MPI
## Overview
### Questions
* How can I access the state of the simulation in parallel simulations?
* What are the differences between local and global snapshots?
### Objectives
* Describe how to write GSD files in MPI simulations.
* Show examples using **local snapshots**... | github_jupyter |
```
import numpy as np
# load data from ReachData.npz
data=np.load('/Users/yangrenqin/GitHub/HW5/ReachData.npz')
r=data['r']
targets=data['targets']
target_index=data['cfr']
data.close()
targets
# convert x,y coordiantes to respective degreees
import math
degrees=[]
for i in targets:
degree=math.degrees(math.atan... | github_jupyter |
<center> <font size=6> <b> Table of Contents </b> </font> </center>
<div id="toc"></div>
The following cell is a Javascript section of code for building the Jupyter notebook's table of content.
```
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')
```
**-_-_-_-... | github_jupyter |
```
!pip install mesa
import sys
sys.path.insert(0, '/Users/ben/covid19-sim-mesa/')
%matplotlib inline
# from https://github.com/ziofil/live_plot
from collections import defaultdict
from matplotlib import pyplot as plt
from IPython.display import clear_output
from itertools import cycle
lines = ['-', '--', '-.', ':']
... | github_jupyter |
# Input HMP
This notebook pulls the HMP accelerometer sensor data classification data set
```
%%bash
export version=`python --version |awk '{print $2}' |awk -F"." '{print $1$2}'`
if [ $version == '36' ]; then
pip install pyspark==2.4.8 wget==3.2 pyspark2pmml==0.5.1
elif [ $version == '38' ]; then
pip install ... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc" style="margin-top: 1em;"><ul class="toc-item"><li><span><a href="#Instructions" data-toc-modified-id="Instructions-1"><span class="toc-item-num">1 </span>Instructions</a></span></li></ul></div>
# Instructions
Run all of the cells. You... | github_jupyter |
# Solution b.
Create a inference script. Let's call it `inference.py`.
Let's also create the `input_fn`, `predict_fn`, `output_fn` and `model_fn` functions.
Copy the cells below and paste in [the main notebook](../xgboost_customer_churn_studio.ipynb).
```
%%writefile inference.py
import os
import pickle
import xg... | github_jupyter |
```
%matplotlib inline
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
torch.manual_seed(1)
import numpy as np
from tqdm import tqdm
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from pytorch_utils impo... | github_jupyter |
```
%cd /opt
%%capture
!tar xvf /kaggle/input/extract-prebuilt-kaldi-from-docker/kaldi.tar
%cd kaldi/egs
!git clone https://github.com/danijel3/ClarinStudioKaldi
%cd ClarinStudioKaldi
#apt-get -y install libperlio-gzip-perl
!conda install -c bioconda perl-perlio-gzip -y
import os
#os.environ['LD_LIBRARY_PATH'] = f'{os.... | github_jupyter |
# 一个完整的机器学习项目
# 房价预测
## 我们选择的是StatLib的加州房产价格数据集
```
# 导入相关包
import pandas as pd
import os
INPUT_PATH = 'dataset' # 输入目录
def load_data(file, path=INPUT_PATH):
"""
加载csv文件
"""
csv_path=os.path.join(path, file)
return pd.read_csv(csv_path)
# 首先我们看下数据,发现有10个属性
housing = load_data("housing.csv"... | github_jupyter |
```
%matplotlib inline
```
links:
* http://scikit-image.org/docs/dev/auto_examples/transform/plot_radon_transform.html
* https://software.intel.com/en-us/node/507042
```
# from minimg import load, MinImg, TYP_REAL32
from numba import jit, prange
import numba
import pylab as plt
from glob import glob
from math import... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D1_RealNeurons/student/W3D1_Tutorial2.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Neuromatch Academy: Week 2, Day 3, Tutorial 2
# Real N... | github_jupyter |
```
import numpy as np
filename = 'glove.840B.300d.txt'
# (glove data set from: https://nlp.stanford.edu/projects/glove/)
word_vec_dim = 300 # word_vec_dim = dimension of each word vectors
def loadEmbeddings(filename):
vocab2embd = {}
with open(filename) as infile:
for line in infile:
... | github_jupyter |
## Here, you'll learn all about merging pandas DataFrames. You'll explore different techniques for merging, and learn about left joins, right joins, inner joins, and outer joins, as well as when to use which. You'll also learn about ordered merging, which is useful when you want to merge DataFrames whose columns have n... | github_jupyter |
# Model Layers
This module contains many layer classes that we might be interested in using in our models. These layers complement the default [Pytorch layers](https://pytorch.org/docs/stable/nn.html) which we can also use as predefined layers.
```
from fastai import *
from fastai.vision import *
from fastai.gen_doc.... | github_jupyter |
# Working with functions
<section class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="fa fa-certificate"></span> Learning Objectives:</h2>
</div>
<div class="panel-body">
<ul>
<li>Define a function that takes parameters.</li>
<li>Return a value from a function.</li>
<li>Test and de... | github_jupyter |
# Ch05
```
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import statsmodels.api as sm
%load_ext autoreload
%autoreload 2
plt.style.use('seaborn-talk')
plt.style.use('bmh')
pd.set_option('display.max_rows', 100)
```
## 5.1 Generate a time series from an IID Gauss... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import faiss
import pickle
import numpy as np
import os
from tools.utils import draw_bbboxes
from pycocotools.coco import COCO
print(os.getcwd())
OUTPUT_PATH="images/threshold_study/final_feature_db_on_train.npy"
feautre_db = np.load(OUTPUT_PATH)
coco = COCO("/home.nfs/babayeln/t... | github_jupyter |
# An Introduction to the Amazon SageMaker IP Insights Algorithm
#### Unsupervised anomaly detection for susicipous IP addresses
-------
1. [Introduction](#Introduction)
2. [Setup](#Setup)
3. [Training](#Training)
4. [Inference](#Inference)
5. [Epilogue](#Epilogue)
## Introduction
-------
The Amazon SageMaker IP Insig... | github_jupyter |
```
############## PLEASE RUN THIS CELL FIRST! ###################
# import everything and define a test runner function
from importlib import reload
from helper import run
import helper
```
### This is a Jupyter Notebook
You can write Python code and it will execute. You can write the typical 'hello world' program l... | github_jupyter |
```
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
from surprise import Reader, Dataset, SVD
from surprise.model_selection import KFold
from surprise.model_selection.validation import cross_validate
import copy
from d... | github_jupyter |
# Exploring Machine Learning on Quantopian
Recently, Quantopian’s Chief Investment Officer, Jonathan Larkin, shared an industry insider’s overview of the [professional quant equity workflow][1]. This workflow is comprised of distinct stages including: (1) Universe Definition, (2) Alpha Discovery, (3) Alpha Combination... | github_jupyter |
# Use case Schouwen Westkop Noord
## 1. Import functionality
```
from functions import *
```
## 3. User defined values
```
load_factor =np.array([0,0.1,0.2,0.3, 0.4,0.5,0.6,0.7,0.8,0.9,1]) # Roadmap11
start = [3.674, 51.70969009] # Location of the koppelpunt (... | github_jupyter |
## Dependencies
```
!pip install --quiet /kaggle/input/kerasapplications
!pip install --quiet /kaggle/input/efficientnet-git
import warnings, glob
from tensorflow.keras import Sequential, Model
import efficientnet.tfkeras as efn
from cassava_scripts import *
seed = 0
seed_everything(seed)
warnings.filterwarnings('ig... | github_jupyter |
# Naive Bayes
Naive Bayes is a method of calculating the probability of a element belonging to a certain class. Naive Bayes is a classification algorithm that focuses on efficiency more than accuracy. The Bayes' Theorm states:
$$ p(class|data) = (p(data|class) * p(class)) / p(data) $$
- $ p(class|data) $ is the probab... | github_jupyter |
# Class 4 - Hybrid LCA
In this class, we will learn about supply use tables, and input output tables. We will also do a toy hybrid LCA.
Before getting started, make sure you have upgrade the Brightway2 packages. You should have at least the following:
```
import bw2data, bw2calc, bw2io
print("BW2 data:", bw2data.__v... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%config Completer.use_jedi = False
import yaml
from pysmFISH.pipeline import Pipeline
from pysmFISH.configuration_files import load_experiment_config_file
from pathlib import Path
import time
```
# LBEXP20210513_EEL_Control_PDL_Elect
```
experiment_fpath = Path('/fish/work_std/L... | github_jupyter |
<a href="https://colab.research.google.com/github/VICIWUOHA/Multiple_Text_Combination_and_Mapping/blob/main/Multiple_Text_Combination_and_Mapping.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
#Multiple Text Combination and Mapping Project
The aim... | github_jupyter |
<a href="https://colab.research.google.com/github/Serbeld/Tensorflow/blob/master/PruebaMnist_with_custom_callback.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
#!pip install tensorflow==1.3
#!pip install keras
import tensorflow as tf
print(tf.... | github_jupyter |
In this notebook I will show the different options to save and load a model, as well as some additional objects produced during training.
On a given day, you train a model...
```
import pickle
import numpy as np
import pandas as pd
import torch
import shutil
from pytorch_widedeep.preprocessing import WidePreprocess... | github_jupyter |
```
%matplotlib inline
import time
import numpy as np
from matplotlib import cm
from matplotlib import pyplot as plt
from scipy.stats import mode
from clustiVAT import clustiVAT
from data_generate import data_generate
from distance2 import distance2
from iVAT import iVAT
total_no_of_points = 1000
clusters = 4
odds_ma... | github_jupyter |
```
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | github_jupyter |
# LEARNING
This notebook serves as supporting material for topics covered in **Chapter 18 - Learning from Examples** , **Chapter 19 - Knowledge in Learning**, **Chapter 20 - Learning Probabilistic Models** from the book *Artificial Intelligence: A Modern Approach*. This notebook uses implementations from [learning.py]... | github_jupyter |
```
import pandas as pd
import numpy as np
import math
import random
import operator
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn import linear_model
from sklearn.linear_model import LinearRegression
from sklearn import metrics
from sklearn.metrics import mean... | github_jupyter |
# Task 2 Evaluation
This notebook contains the evaluation for Task 1 of the TREC Fair Ranking track.
## Setup
We begin by loading necessary libraries:
```
from pathlib import Path
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import gzip
import binpickle
```
Set up pr... | github_jupyter |
<a href="https://colab.research.google.com/github/kalz2q/mycolabnotebooks/blob/master/kaggle07import.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# メモ
1. kaggle の Python tutorial をベスに Colab ノートブックを作成している。
1. Colab で開いて読まれることを想定。
1. 元ファイル ( https... | github_jupyter |
```
from PyQt4.QtCore import *
import urllib2, json
import zipfile
try:
import zlib
compression = zipfile.ZIP_DEFLATED
except:
compression = zipfile.ZIP_STORED
#here maps api
appcode ="5socj0x3K2SWWpkQUBLaYA"
appID = "gnLbXQVI5RzAIoGTzF9G"
import pandas as pd
import datetime
yeardata={}
town='csikszereda'
t... | github_jupyter |
For MS training we have 3 datasets: train, validation and holdout
```
import numpy as np
import pandas as pd
import nibabel as nib
from scipy import interp
from sklearn.utils import shuffle
from sklearn.model_selection import GroupShuffleSplit
from sklearn.metrics import confusion_matrix, roc_auc_score, roc_curve, au... | github_jupyter |
# What is Python?
- [How do computers work?](#How-do-computers-work?)
- [Python: Stats, strengths and weaknesses](#Python:-Stats,-strengths-and-weaknesses)
- [Python: Past, present and future](#Python:-Past,-present-and-future)
- [The outside of a pythonista](#The-outside-of-a-pythonista)
- [MAKE PYTHON WORK AGAIN!](#... | github_jupyter |
# eICU Collaborative Research Database
# Notebook 2: Demographics and severity of illness in a single patient
The aim of this notebook is to introduce high level admission details relating to a single patient stay, using the following tables:
- `patient`
- `admissiondx`
- `apacheapsvar`
- `apachepredvar`
- `apachepa... | github_jupyter |
# Intelligent Systems Assignment 1
## Masterball solver
**Name:**
**ID:**
### 1. Create a class to model the Masterball problem
A Masterball must be represented as an array of arrays with integer values representing the color of the tile in each position:
A solved masterball must look like this:
```python
[ [0, ... | github_jupyter |
<small><small><i>
All the IPython Notebooks in **[Python Natural Language Processing](https://github.com/milaan9/Python_Python_Natural_Language_Processing)** lecture series by **[Dr. Milaan Parmar](https://www.linkedin.com/in/milaanparmar/)** are available @ **[GitHub](https://github.com/milaan9)**
</i></small></small>... | github_jupyter |
# Evaluation script for MiniBrass Evaluation results
## WCSP-Solver Comparison
The first section sets up the connection to the database, installs GeomMean as aggregate function, and counts problem instances.
```
import sqlite3
import numpy as np
import scipy.stats as st
%pylab inline
class GeomMean:
def __init_... | github_jupyter |
# Forecasting forced displacement
```
import pandas as pd
from time import time
import os
import json
import pickle
import numpy as np
from time import time
import seaborn as sns
import matplotlib.pyplot as plt
```
# Data transforms
<TBC>
```
start_time = time()
with open("../configuration.json", 'rt') as infile:... | github_jupyter |
<a href="https://colab.research.google.com/github/Educat8n/Reinforcement-Learning-for-Game-Playing-and-More/blob/main/Module3/Module_3.1_DQN.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Module 3: DRL Algorithm Implementations
 dataset to be used... | github_jupyter |
```
from scipy import linalg
import matplotlib
```
This algorithm was taken from scikit-learn v0.13 (the current is an equivalent Cython implementation), it just adds the callback argument
```
def isotonic_regression(y, weight=None, y_min=None, y_max=None, callback=None):
"""Solve the isotonic regression model::
... | github_jupyter |
---
_You are currently looking at **version 1.2** 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-social-network-analysis/resources/yPcBs) course resource._
---
# Assignmen... | github_jupyter |
## This notebook allows the user to train their own version of the GPU model from scratch
- This notebook can also be run using the `2_train_gpu_model.py` file in this folder.
#### Notes
- The training data for training the GPU model uses a separate file format. We have also uploaded training data ( the one we used ... | github_jupyter |
# DataJoint Workflow Array Ephys
This notebook will describe the steps for interacting with the data ingested into `workflow-array-ephys`.
```
import os
os.chdir('..')
import datajoint as dj
import matplotlib.pyplot as plt
import numpy as np
from workflow_array_ephys.pipeline import lab, subject, session, ephys
```
... | github_jupyter |
<a href="https://colab.research.google.com/github/agemagician/CodeTrans/blob/main/prediction/multitask/pre-training/source%20code%20summarization/sql/small_model.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
**<h3>Summarize the sql source code usi... | github_jupyter |
# Building your Deep Neural Network: Step by Step
Welcome to your week 4 assignment (part 1 of 2)! You have previously trained a __2-layer Neural Network__ (with a _single_ `hidden layer`). This week, you will build a deep neural network, with as many layers as you want! :x
- In this notebook, you will implement all ... | github_jupyter |
# CLS Vector Analysis IMDB Dataset
## Imports & Inits
```
%load_ext autoreload
%autoreload 2
%config IPCompleter.greedy=True
import pdb, pickle, sys, warnings, itertools, re, tqdm
warnings.filterwarnings(action='ignore')
sys.path.insert(0, '../scripts')
from IPython.display import display, HTML
import pandas as pd... | github_jupyter |
| [01_word_embedding/03_Word2Vec.ipynb](https://github.com/shibing624/nlp-tutorial/blob/main/01_word_embedding/03_Word2Vec.ipynb) | 基于gensim使用word2vec模型 |[Open In Colab](https://colab.research.google.com/github/shibing624/nlp-tutorial/blob/main/01_word_embedding/03_Word2Vec.ipynb) |
# Word2Vec
这节通过gensim和pytorch训练日... | github_jupyter |
```
"""
You can run either this notebook locally (if you have all the dependencies and a GPU) or on Google Colab.
Instructions for setting up Colab are as follows:
1. Open a new Python 3 notebook.
2. Import this notebook from GitHub (File -> Upload Notebook -> "GITHUB" tab -> copy/paste GitHub URL)
3. Connect to an in... | github_jupyter |
```
import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
import numpy as np
from scipy import stats
import scipy as sp
import datetime as dt
from ei_net import *
from ce_net import *
from collections import Counter
%matplotlib inline
##########################################
############ PLOT... | github_jupyter |
**Chapter 1 – The Machine Learning landscape**
_This is the code used to generate some of the figures in chapter 1._
# Setup
First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures:
```
# T... | github_jupyter |
# Working with preprocessing layers
**Authors:** Francois Chollet, Mark Omernick<br>
**Date created:** 2020/07/25<br>
**Last modified:** 2021/04/23<br>
**Description:** Overview of how to leverage preprocessing layers to create end-to-end models.
## Keras preprocessing
The Keras preprocessing layers API allows devel... | github_jupyter |
```
#we may need some code in the ../python directory and/or matplotlib styles
import sys
import os
sys.path.append('../python/')
#set up matplotlib
os.environ['MPLCONFIGDIR'] = '../mplstyles'
print(os.environ['MPLCONFIGDIR'])
import matplotlib as mpl
from matplotlib import pyplot as plt
#got smarter about the mpl con... | github_jupyter |
## Let's import some basic packages
```
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
module_url = "https://tfhub.dev/google/universal-sentence-encoder-large/3"
embed = hub.Module(module_url)
```
## And here's an basic example of how embeddings work
```
word = "Elephant"
sentence = "I am ... | github_jupyter |
# Testing Cnots
In this notebook we take imperfect versions of cnot gates and see how well they would work within a `d=3`, `T=1` surface code and a `d=5`, `T=3` repetition code.
```
import numpy as np
from copy import deepcopy
from topological_codes import RepetitionCode, SurfaceCode, GraphDecoder
from qiskit impor... | github_jupyter |
```
import torch
import pandas as pd
import numpy as np
import seaborn as sns
import os
sns.set(style="darkgrid")
import matplotlib.pyplot as plt
from glob import glob
%matplotlib inline
def get_title(filename):
"""
>>> get_title("logs/0613/0613-q1-0000.train")
'0613-q1-0000'
"""
return os.path.s... | github_jupyter |
# Extração de texto em relatórios da Fundação ABC - Experimento
TODO:
* Aplicar filtros nesta etapa
### **Em caso de dúvidas, consulte os [tutoriais da PlatIAgro](https://platiagro.github.io/tutorials/).**
## Declaração de parâmetros e hiperparâmetros
Declare parâmetros com o botão <img src="data:image/png;base64,i... | github_jupyter |
Nota para antes de leer este documento:<br>
<b><i> 1. El paquete dst contiene toda la implementación de las ideas aquí expuestas. El notebook 2. Implementación incluye implementaciones para distintas configuraciones. En el presente documento se expondrá código de manera ilustrativa, sin embargo, el paquete es el encarg... | github_jupyter |
# Collaborative filtering on the MovieLense Dataset
## Learning Objectives
1. Know how to explore the data using BigQuery
2. Know how to use the model to make recommendations for a user
3. Know how to use the model to recommend an item to a group of users
###### This notebook is based on part of Chapter 9 of [BigQuer... | github_jupyter |
```
import os
import imageio
import numpy as np
import warnings
warnings.filterwarnings('ignore',category=FutureWarning)
import tensorflow as tf
import matplotlib.pyplot as plt
from glob import glob
import cv2
import shutil
tf.logging.set_verbosity(tf.logging.ERROR)
class Helpers():
@staticmethod
def norma... | github_jupyter |
## NYUD+KITTI- joint semantic segmentation and depth estimation on both datasets with a single network
```
%matplotlib inline
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
import sys
sys.path.append('../')
from models import net
import cv2
import torch
from torch.autograd import Variable
# ... | github_jupyter |
# Charting OSeMOSYS transformation data
### These charts won't necessarily need to be mapped back to EGEDA historical.
### Will effectively be base year and out
### But will be good to incorporate some historical generation before the base year eventually
```
import pandas as pd
import numpy as np
import matplotlib.p... | github_jupyter |
**TODO**
- create a better control stuc for internal parameters to, look as SKiDl's lib file that does the conversion from SKiDl to pyspice for inspiration
```
#Library import statements
from skidl.pyspice import *
#can you say cheeky
import PySpice as pspice
#becouse it's written by a kiwi you know
import lcapy as ... | github_jupyter |
# Grid search forecaster
Skforecast library combines grid search strategy with backtesting to identify the combination of lags and hyperparameters that achieve the best prediction performance.
The grid search requires two grids, one with the different lags configuration (`lags_grid`) and the other with the list of hy... | github_jupyter |
# The IMDb Dataset
The IMDb dataset consists of sentences from movie reviews and human annotations of their sentiment. The task is to predict the sentiment of a given sentence. We use the two-way (positive/negative) class split, and use only sentence-level labels.
```
from IPython.display import display, Markdown
with... | github_jupyter |
# Lecture 30 – Perception, Case Study
## Data 94, Spring 2021
```
from datascience import *
import numpy as np
Table.interactive_plots()
import plotly.express as px
sky = Table.read_table('data/skyscrapers.csv') \
.where('status.current', are.contained_in(['completed', 'under construction'])) \
... | github_jupyter |
# [Introductory applied machine learning (INFR10069)](https://www.learn.ed.ac.uk/webapps/blackboard/execute/content/blankPage?cmd=view&content_id=_2651677_1&course_id=_53633_1)
# Lab 5: Neural Networks
*by [James Owers](https://jamesowers.github.io/), University of Edinburgh 2017*
1. [Introduction](#Introduction)
... | github_jupyter |
### Import api_crawler
[Code for api_crawler](https://github.com/biothings/JSON-LD_BioThings_API_DEMO/blob/master/src/api_crawler.py)
```
from api_crawler import uri_query
```
### Given a variant hgvs id, looking for ncbi gene id related to it
```
uri_query(input_value='chr12:g.103234255C>T', input_name='http://ide... | github_jupyter |
```
# LSTM for international airline passengers problem with window regression framing
import numpy
import numpy as np
import keras
import matplotlib.pyplot as plt
from pandas import read_csv
import math
from keras.models import Sequential
from keras.layers import Dense,Dropout
from keras.layers import LSTM
from sklear... | github_jupyter |
# Sched Square
This tutorial includes everything you need to set up decision optimization engines, build constraint programming models.
When you finish this tutorial, you'll have a foundational knowledge of _Prescriptive Analytics_.
>This notebook is part of **[Prescriptive Analytics for Python](http://ibmdecisiono... | github_jupyter |
```
%matplotlib inline
from astropy.table import Table
data = Table.read('/home/jls/public_html/data/gaia_spectro.hdf5')
dataE = Table.read('/data/jls/GaiaDR2/spectro/input_photometry_and_spectroscopy.hdf5')
def turnoff(d):
return (d['logg']<4.5)&(d['logg']>3.6)&(d['log10_teff']<4.1)
# return (d['logg']>3.)&(d[... | github_jupyter |
# Programming Exercise 5:
# Regularized Linear Regression and Bias vs Variance
## Introduction
In this exercise, you will implement regularized linear regression and use it to study models with different bias-variance properties. Before starting on the programming exercise, we strongly recommend watching the video le... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)
warnings.filterwarnings('ignore', category=FutureWarning)
import sklearn
sklearn.set_config(print_changed_only=True)
```
# Algorithm Chains and Pipelines
```
from s... | github_jupyter |
# 利用Python对链家网北京主城区二手房进行数据分析
* 本文主要讲述如何通过pandas对爬虫下来的链家数据进行相应的二手房数据分析,主要分析内容包括各个行政区,各个小区的房源信息情况。
* 数据来源 https://github.com/XuefengHuang/lianjia-scrawler 该repo提供了python程序进行链家网爬虫,并从中提取二手房价格、面积、户型和二手房关注度等数据。
* 分析方法参考 http://www.jianshu.com/p/44f261a62c0f
## 导入链家网二手房在售房源的文件(数据更新时间2017-11-29)
```
import pandas as pd
impor... | github_jupyter |
```
import datetime
from pytz import timezone
print "Last run @%s" % (datetime.datetime.now(timezone('US/Pacific')))
from pyspark.context import SparkContext
print "Running Spark Version %s" % (sc.version)
from pyspark.conf import SparkConf
conf = SparkConf()
print conf.toDebugString()
# Read Orders
orders = sqlContext... | github_jupyter |
# Example: Compare CZT to FFT
```
%load_ext autoreload
%autoreload 2
import numpy as np
import matplotlib.pyplot as plt
# CZT package
import czt
# https://github.com/garrettj403/SciencePlots
plt.style.use(['science', 'notebook'])
```
# Generate Time-Domain Signal
```
# Time data
t = np.arange(0, 20, 0.1) * 1e-3
d... | github_jupyter |
```
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | github_jupyter |
.. meta::
:description: A guide which introduces the most important steps to get started with pymoo, an open-source multi-objective optimization framework in Python.
.. meta::
:keywords: Multi-objective Optimization, Python, Evolutionary Computation, Optimization Test Problem, Hypervolume
```
%%capture
%run par... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.