text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
# Use Case 6: Comparing Derived Molecular Data with Proteomics
For this use case, we will be looking at the derived molecular data contained in the Endometrial dataset, and comparing it with protein data. Derived molecular data means that we created new variables based on molecular data. One example of this is the act... | github_jupyter |
# Dangers of Multiple Comparisons
Testing multiple hypothesis from the same data can be problematic. Exhaustively testing all pairwise relationships between variables in a data set is a commonly used, but generally misleading from of multiple comparisons. The chance of finding false significance, using such a **data d... | github_jupyter |
<a href="https://colab.research.google.com/github/hsuanchia/Image-caption/blob/main/generate_caption.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
from google.colab import drive
drive.mount('/content/drive')
import json,pickle, os, sys
import ... | github_jupyter |
##### Copyright 2019 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 |
### OkCupid DataSet
### Meeting 4, 28- 01- 2020
### Recap last meeting's decisions:
<ol>
<p>Meeting 3, 10- 12- 2019</p>
<li>Check all the preprocessing steps.</li>
<li>The dataset is extremely imbalanced.</li>
<li>Exclude class 1 and class 5 inorder to make the dataset balanced.</li>
</ol>
### To discu... | github_jupyter |
# Train an SVM Classifier on MNIST Data
In this example we will load labels and pointers to the data into a Gota dataframe.
```
import (
"fmt"
mnist "github.com/petar/GoMNIST"
"github.com/kniren/gota/dataframe"
"github.com/kniren/gota/series"
"math/rand"
"os"
)
set, err := mnist.ReadSet("../d... | github_jupyter |
## Random Forest Code for generating a baseline
```
from sklearn.ensemble import RandomForestClassifier
import pickle
import numpy as np
```
### specify file to load data below
```
with open('../database/combined_dict_norm_all_examples.pickle','rb') as handle:
combined_dict = pickle.load(handle)
with open('../da... | github_jupyter |
```
from collections import Counter
from functools import partial
import gc
from multiprocessing import Pool
import numpy as np
import pandas as pd
from scipy.stats import f_oneway
from scipy.spatial.distance import squareform
from statsmodels.stats.multicomp import pairwise_tukeyhsd
from tqdm import trange
from make... | github_jupyter |
# Word2Vec
**Learning Objectives**
1. Compile all steps into one function
2. Prepare training data for Word2Vec
3. Model and Training
4. Embedding lookup and analysis
## Introduction
Word2Vec is not a singular algorithm, rather, it is a family of model architectures and optimizations that can be used to learn wo... | github_jupyter |
# Running a Federated Cycle with Synergos
In a federated learning system, there are many contributory participants, known as Worker nodes, which receive a global model to train on, with their own local dataset. The dataset does not leave the individual Worker nodes at any point, and remains private to the node.
The j... | github_jupyter |
## Simple k-means clustering algorithm for 2D data
This is simply meant to show the inner workings of the k-means clustering unsupervised technique with a simple dataset of two features and two classes for clear visualization.
```
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets
import l... | github_jupyter |
## NMF = Not Monday night Football !
```
import pandas as pd
import numpy as np
from sklearn.decomposition import NMF
import random
from random import randint
from matplotlib import pyplot as plt
%matplotlib inline
```
# User Input
```
#importing ratings and movies csv files
PATH2 = "ratings.csv"
PATH3 = "movies.csv... | github_jupyter |
```
#Opencv Version use 3.3., Python 2.7.
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
from moviepy.editor import VideoFileClip
#image = mpimg.imread('test_images/solidWhiteRight.jpg')
image = mpimg.imread('test_images/solidWhiteCurve.jpg')
#image = mpimg.imread('tes... | github_jupyter |
# 1. Unsupervised Learning
```
%matplotlib inline
import scipy
import numpy as np
import itertools
import matplotlib.pyplot as plt
```
## 1. Generating the data
First, we will generate some data for this problem. Set the number of points $N=400$, their dimension $D=2$, and the number of clusters $K=2$, and generate ... | github_jupyter |
<b>The code below used STLM by using only Capacity field to predict the RUL(STLM using one variable with multisteps)</b>
<p>We built the model only on Battery B0005</p>
```
import sys
import numpy as np # linear algebra
from scipy.stats import randint
import pandas as pd # data processing, CSV file I/O (e.g. pd.read... | github_jupyter |
[](https://colab.research.google.com/github/eirasf/GCED-AA2/blob/main/lab2/lab2-parte2.ipynb)
# Práctica 1: Redes neuronales desde cero con TensorFlow - Parte 2
En esta segunda parte de la práctica vamos a utilizar TensorFlow para implementar y... | github_jupyter |
### Representing and minimizing rules
*(You'll need to: `conda install pyrsistent networkx` and then `pip install nxpd`. You'll also need graphviz.)*
Our rules are represented as positive monotone formulae in CNF. This is flexible enough for practical purposes, while still allowing us to define a normal form suitable... | github_jupyter |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/1_getting_started_roadmap/1_getting_started_with_monk/3)%20Dog%20Vs%20Cat%20Classifier%20Using%20Keras%20Backend.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open I... | github_jupyter |
# Market Basket Analysis
- Construct association rules
- Identify items purchased together
## Association Rules
- (Antecedent) => (Consequent)
- e.g (Fiction) => (Biography) means buying Fiction makes them buy Biography
```
import pandas as pd
import numpy as np
books = pd.read_csv(
"https://assets.datacamp... | github_jupyter |
```
import numpy as np
import scipy.stats
import scs
#############################################
# Generate random cone problems #
#############################################
def pos(x):
return (x + np.abs(x)) / 2.
def gen_feasible(m, n, p_scale = 0.1):
z = np.random.randn(m)
y = pos(z... | github_jupyter |
#### Setup Notebook
```
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:80% !important; }</style>"))
# Put these at the top of every notebook, to get automatic reloading and inline plotting
%reload_ext autoreload
%autoreload 2
%matplotlib inline
```
# Predicting Price Movements ... | github_jupyter |
# Interactive Data Exploration, Analysis, and Reporting
- Author: Team Data Science Process from Microsoft
- Date: 2017/03
- Supported Data Sources: CSV files on the machine where the Jupyter notebook runs or data stored in SQL server
- Output: IDEAR_Report.ipynb
This is the **Interactive Data Exploration, Analysis... | github_jupyter |
# GAN
```
import pandas as pd
import numpy as np
dataset = "YOUR_DATASET" # DATAFRAME
display(dataset)
train_X = "YOUR TRAINING INPUT" # NUMPY
train_Y = "YOUR TRAINING LABEL" # NUMPY
print(train_X.shape)
print(train_Y.shape)
val_X = "YOUR VALIDATION LABEL" # NUMPY
val_Y = "YOUR VALIDATION LABEL" # NUMPY
print(val... | github_jupyter |
# Importing
```
import pandas as pd
import numpy as np
#import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs, make_moons, make_circles
#import hdbscan
from sklearn.neighbors import NearestNeighbors
from sklearn.cluster import SpectralClustering, KMeans, AgglomerativeClusterin... | github_jupyter |
<h1>SVHN Classification using CNNs</h1>
---
# Importing Keras Modules
```
#Importing important modules
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
from tensorflow.keras.callbacks import ModelCheckp... | github_jupyter |
## Dependencies
```
import os
import sys
import cv2
import shutil
import random
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
import multiprocessing as mp
import matplotlib.pyplot as plt
from tensorflow import set_random_seed
from sklearn.utils import class_weight
from sklearn.model_sele... | github_jupyter |
```
import os
import cv2
import functools
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import matplotlib.pyplot as plt
from matplotlib import gridspec
from fst_func import load_image, resize_image_to_square, crop_center, show_n
print('TF Version: ', tf.__version__)
print('TF-Hub Version: ', h... | github_jupyter |
```
import sys
import time
import os.path
from glob import glob
from datetime import datetime, timedelta
# data tools
import h5py
import numpy as np
# custom tools
sys.path.insert(0, '/glade/u/home/ksha/WORKSPACE/utils/')
sys.path.insert(0, '/glade/u/home/ksha/WORKSPACE/Analog_BC/')
sys.path.insert(0, '/glade/u/home/... | github_jupyter |
# Natural Language Entity Extraction
Extracting Ground Truth Labels from Radiology Reports
<hr/>
<img src="example-report.png" width="30%" align="right" style="padding-left:20px">
In this assignment you'll learn to extract information from unstructured medical text. In particular, you'll learn about the following top... | github_jupyter |
Before we begin, let's execute the cell below to display information about the CUDA driver and GPUs running on the server by running the `nvidia-smi` command. To do this, execute the cell block below by giving it focus (clicking on it with your mouse), and hitting Ctrl-Enter, or pressing the play button in the toolbar ... | github_jupyter |
## Visualizing the 2016 General Election Polls
```
from __future__ import print_function
import pandas as pd
import numpy as np
from ipywidgets import VBox, HBox
import os
codes = pd.read_csv(os.path.abspath('../data_files/state_codes.csv'))
try:
from pollster import Pollster
except ImportError:
print('Pollst... | 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 |
## Land Cover Classification
In this tutorial, we'll learn how to apply a land cover classification model to imagery hosted in the [Planetary Computer Data Catalog](https://planetarycomputer.microsoft.com/catalog). In the process, we'll see how to:
1. Create a Dask Cluster where each worker has a GPU
2. Use the Plane... | github_jupyter |
## <center>Missing data in supervised ML</center>
### <center>Andras Zsom</center>
<center>Lead Data Scientist and Adjunct Lecturer in Data Science</center>
<center>Center for Computation and Visualization</center>
<center>Brown University</center>
https://github.com/brown-ccv/ODSC-East-2021
## About me
- Born and ra... | github_jupyter |
EDA to Typhoon Mitigation and Response Framework (TMRF)
“Experience is a master teacher, even when it’s not our own.”
― Gina Greenlee
The Philippines' apparent vulnerability to natural disasters emerges from its geographic location within the Pacific Ring of Fire. The country is surrounded by large bodies of water an... | github_jupyter |
# Feature Engineering
Practice creating new features from the GDP and population data.
You'll create a new feature gdppercapita, which is GDP divided by population. You'll then write code to create new features like GDP squared and GDP cubed.
Start by running the code below. It reads in the World Bank data, filter... | github_jupyter |
# Detail of other tries
## Outline
***
* Preprocessing data
* Tokenlization and punctutation cleaning
* Hypertuning Word2Vec model
* Choose the classifier
* Hypertuning classifier
* Result
* Conclusion
## Preprocessing
***
```
# Inport the necessary package
import pandas as pd
import nltk
import numpy as np
# Check... | github_jupyter |
get data from local database
```
# %%time
import pandas as pd
import psycopg2
import os
from sklearn.model_selection import train_test_split
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
# read data from local psql database into pd dataframe
try:
conn = psycopg2.connect(database='parcelDa... | github_jupyter |
# Graph Coloring with Gaussian Boson Sampling
Here we demonstrate some graph colorings aided by GBS on Xanadu's simulator
### Copy and paste some useful unreleased Xanadu functions for finding subgraphs
```
# Copyright 2019 Xanadu Quantum Technologies Inc.
r"""
Dense subgraph identification
=========================... | github_jupyter |
# XGBoost原理与应用
作者:杨岱川
时间:2019年11月
github:https://github.com/DrDavidS/basic_Machine_Learning
开源协议:[MIT](https://github.com/DrDavidS/basic_Machine_Learning/blob/master/LICENSE)
参考文章:
- [XGBoost PPT](https://homes.cs.washington.edu/~tqchen/pdf/BoostedTree.pdf)
- [XGBoost: A Scalable Tree Boosting System](https://arx... | github_jupyter |
# Climate CDS
The ERA5 database is migrated from the ECMWF databases to the CDS databases. Meaning we need to migrate with them, also the reason why the old programm did not gave the wanted results.
<hr>
Olivier den Ouden (<a href="ouden@knmi.nl">ouden@knmi.nl</a>)<br>
R&D Seismology and Acoustics @ KNMI (Royal Nethe... | github_jupyter |
```
from glob import iglob
import os
import pandas as pd
import screed
import seaborn as sns
from tqdm import tqdm
```
# Change to Quest for Orthologs 2019 data directory
```
cd ~/data_sm/kmer-hashing/quest-for-orthologs/data/2019/
ls -lha
ls Eukaryota/
```
# Download orthology and transcription factor data
## Rea... | github_jupyter |
Acoustic system calibration
===========================
Since the calibration measurements may be dealing with very small values, there's potential for running into the limitations of <a href="https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html">floating-point arithmetic</a>. When implementing the computa... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Image/image_stats_by_band.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blank" hr... | github_jupyter |
**Note**: Click on "*Kernel*" > "*Restart Kernel and Clear All Outputs*" in [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/) *before* reading this notebook to reset its output. If you cannot run this file on your machine, you may want to open it [in the cloud <img height="12" style="display: inline-block" src... | github_jupyter |
### Replicates and linear regression
```
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import OneHotEncoder
import numpy as np
import seaborn as sns
import scipy.stats as stats
import pandas as pd
# N = 1000
# num_boot = 10000
# num_donors = 3
# donors = np.random.choice(['a','b','c'], s... | github_jupyter |
# **Distilling Knowledge In Multiple Students Using GANs**
```
# %tensorflow_version 1.x
# !pip install --upgrade opencv-python==3.4.2.17
import numpy as np
import tensorflow as tf
import tensorflow.keras
import tensorflow.keras.backend as K
# import os
from tensorflow.keras.datasets import fashion_mnist,mnist,cifar10... | github_jupyter |
# Mount Drive & Login to Wandb
```
from google.colab import drive
from getpass import getpass
import urllib
import os
# Mount drive
drive.mount('/content/drive')
!pip install wandb -qqq
!wandb login
```
# Install dependencies
```
!rm -r pearl
!git clone https://github.com/PAL-ML/PEARL_v1.git pearl
%cd pearl
!pip ... | github_jupyter |
# Example: CanvasXpress dotplot Chart No. 4
This example page demonstrates how to, using the Python package, create a chart that matches the CanvasXpress online example located at:
https://www.canvasxpress.org/examples/dotplot-4.html
This example is generated using the reproducible JSON obtained from the above page ... | github_jupyter |
# Exploring the Capabilities of the STMicroelectonics Sensor Tile
<div style="text-align: center; ">
<figure>
<img src="img/sensor_tile.png" alt="STEVAL-STWINKT1" style="background:none; border:none; box-shadow:none; text-align:center" width="400px"/>
</figure>
</div>
## Sensing Elements
The STEVAL-STWINKT1 sensor ... | github_jupyter |
When we talk about quantum computing, we actually talk about several different paradigms. The most common one is gate-model quantum computing, in the vein we discussed in the previous notebook. In this case, gates are applied on qubit registers to perform arbitrary transformations of quantum states made up of qubits.
... | github_jupyter |
# Deep Learning for Text
```
import sys
import os
import pandas as pd
# FOLDERS
package_path = os.path.dirname(os.getcwd())
data_path = os.path.join(package_path, 'data')
experiments_path = os.path.join(package_path, 'experiments')
# LOAD DATA
input_file = os.path.join(data_path, 'train.json')
df = pd.read_json(in... | github_jupyter |
## Dependencies
```
import json, glob
from tweet_utility_scripts import *
from tweet_utility_preprocess_roberta_scripts_aux import *
from transformers import TFRobertaModel, RobertaConfig
from tokenizers import ByteLevelBPETokenizer
from tensorflow.keras import layers
from tensorflow.keras.models import Model
```
# L... | github_jupyter |
<a href="https://colab.research.google.com/github/krakowiakpawel9/machine-learning-bootcamp/blob/master/unsupervised/03_association_rules/01_apriori.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
### scikit-learn
Strona biblioteki: [https://scikit-... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from PIL import Image
import numpy as np
from skimage.measure import profile_line
from scipy import sparse
from pymatreader import read_mat
import pandas as pd
import cProfile
from util import get_path
from extract_graph import generate_g... | github_jupyter |
Making Peter happy
```
from glob import glob
import datetime
import numpy as np
from astropy.table import Table
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
from scipy.stats import spearmanr
from scipy.stats import ks_2samp
from scipy.stats import mannwh... | github_jupyter |
<a href="https://colab.research.google.com/github/bkkaggle/pytorch-CycleGAN-and-pix2pix/blob/master/pix2pix.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Install
```
!git clone https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
import os
o... | github_jupyter |
```
import sys
sys.path.append('../')
%load_ext autoreload
%autoreload 2
import sklearn
import copy
import numpy as np
import scipy as sp
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import seaborn as sns
# from viz import viz
from bokeh.plotting import figure, show, output_not... | github_jupyter |
```
import numpy as np
import h5py
import matplotlib.pyplot as plt
%matplotlib inline
from ChangTools.plotting import prettyplot
from ChangTools.plotting import prettycolors
import env
import corner as DFM
# read in illustris SFH file from Tijske
dat = h5py.File('binsv2all1e8Msunh_z0.hdf5', 'r')
dat.keys()
# curren... | github_jupyter |
<!--NOTEBOOK_HEADER-->
*This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks);
content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*
<!--NAVIGATION-->
< [Getting spatial features from a Pose](http://nbviewer.jupyter.org/github/Ros... | github_jupyter |
# Visualize Solar Radiation Data
The data in this notebook come from the [National Solar Radiation Data Base](http://rredc.nrel.gov/solar/old_data/nsrdb/), specifically the [1991 - 2010 update to the National Solar Radiation Database](http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2010/). The data set consists of CS... | github_jupyter |
# Exercise Set 6: Data Structuring 2
*Afternoon, August 15, 2018*
In this Exercise Set we will continue working with the weather data you downloaded and saved in Exercise Set 4.
> **_Note_**: to solve the bonus exercises in this exerise set you will need to apply the `.groupby()` method a few times. This has not ye... | github_jupyter |
# Spectral Representation Method
Author: Lohit Vandanapu
Date: August 19, 2018
Last Modified: May 09, 2019
In this example, the Spectral Representation Method is used to generate stochastic processes from a prescribed Power Spectrum and associated Cross Spectral Density. This example illustrates how to use the SRM cla... | github_jupyter |
# Gradient Boosting Regressor
### Required Packages
```
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as se
from sklearn.model_selection import train_test_split
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.metrics import r2_sco... | github_jupyter |
# Building an even Simpler GAN
```
import numpy as np
from math import *
import theano
import theano.tensor as T
import lasagne
import matplotlib.pyplot as plt
%matplotlib inline
```
## Define the GAN (Generative Adversarial Network)
```
# Definining the GAN
def iGaussian(x):
mx = T.minimum(T.maximum(x,-5),5)
... | github_jupyter |
## https://github.com/timestocome
## The ergodic hypothesis is a key analytical device of equilibrium statistical mechanics. It underlies the assumption that the time average and the expectation value of an observable are the same.
### This 'fix' for economic theory changes everything from gambles to Ponzi schemes... | github_jupyter |
# Hybrid System
In this work, the content-based recommender is combined with the SVD++ rating predictor to give high rating recommendations based on the particular user.
```
import pandas as pd
import numpy as np
import joblib
from surprise import Reader, Dataset, SVDpp
from surprise.model_selection import KFold
from... | github_jupyter |
# Basic Python Semantics: Operators
In the previous section, we began to look at the semantics of Python variables and objects; here we'll dig into the semantics of the various *operators* included in the language.
By the end of this section, you'll have the basic tools to begin comparing and operating on data in Pyth... | github_jupyter |
# Double 7's (Short Term Trading Strategies that Work)
1. The SPY is above its 200-day moving average or X-day ma
2. The SPY closes at a X-day low, buy.
3. If the SPY closes at a X-day high, sell your long position.
Optimize: period, sma, stop loss percent, margin.
```
import datetime
import mat... | github_jupyter |
```
# Import all the necessary files!
import os
import tensorflow as tf
from tensorflow.keras import layers
from tensorflow.keras import Model
# Download the inception v3 weights
!wget --no-check-certificate \
https://storage.googleapis.com/mledu-datasets/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 \
... | github_jupyter |
```
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from tqdm import tqdm
%matplotlib inline
from torch.utils.data import Dataset, DataLoader
import torch
import torchvision
import torch.nn as nn
import torch.optim as optim
from torch.nn import functional as F
device = torch.device("cuda" i... | github_jupyter |
```
import os
import sys
import uuid
import cv2
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.dpi'] = 300
import glob
import json
import requests
import copy
from time import sleep
import pyperclip
k="/opt/share/nginx/upload/1fa348d3-5607-4f58-9c34-a94cd1c928e8.jpg"
page_path = '/'.join(k.... | github_jupyter |
```
import xarray as xr
import pandas as pd
import numpy as np
import seaborn as sns
import sys
sys.path.append('./..')
from refuelplot import *
setup()
sns.set_style("darkgrid")
from paths_zaf import *
def read_ZAFprod():
'''
function for reading production data from csv
replace month names and convert ... | github_jupyter |
# MaterialsCoord benchmarking – ternary materials scores
Benchmark and plot the results of the near neighbor algorithms on ternary structures.
*Written using:*
- MaterialsCoord==0.2.0
*Authors: Hillary Pan, Alex Ganose (03/30/20)*
---
First, lets initialize the near neighbor methods we are interested in.
```
from... | github_jupyter |
```
from typing import List
import pandas as pd
%load_ext autoreload
%autoreload 2
# export
def parse_file(fname: str) -> List[str]:
with open(fname, "r") as f:
contents = f.readlines()
lines = []
line = ""
for c in contents:
line += c
if c == "\n":
line_dict = par... | github_jupyter |
# Practical 2 - Loops and conditional statements
In today's practical we are going to continue practicing working with loops whilst also moving on to the use of conditional statements.
<div class="alert alert-block alert-success">
<b>Objectives:</b> The objectives of todays practical are:
- 1) [Loops: FOR loops con... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
sns.set(rc={'figure.figsize':(12,8)})
confirmed=pd.read_csv("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_glo... | github_jupyter |
## TF v1 implementation of logistic regression for book DLWithTF
```
import numpy as np
np.random.seed(456)
import tensorflow as tf
tf.set_random_seed(456)
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
from scipy.special import logit
# Generate synthetic data
NN = 100
# Zeros form a Gauss... | github_jupyter |
# T81-558: Applications of Deep Neural Networks
**Module 8: Kaggle Data Sets.**
* Instructor: [Jeff Heaton](https://sites.wustl.edu/jeffheaton/), School of Engineering and Applied Science, [Washington University in St. Louis](https://engineering.wustl.edu/Programs/Pages/default.aspx)
* For more information visit the [c... | github_jupyter |
# Data augmentation
```
from nb_200 import *
import random
import pickle
```
## Get the data
```
device = torch.device('cuda', 0)
class PetsData(DataBlock):
types = Image,Category
get_items = lambda source, self: [get_image_files(source)[0]]*100
split = random_splitter()
label_func = re_labeller(pat ... | github_jupyter |
# 결정 트리
<table align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/rickiepark/hg-mldl/blob/master/5-1.ipynb"><img src="https://www.tensorflow.org/images/colab_logo_32px.png" />구글 코랩에서 실행하기</a>
</td>
</table>
## 로지스틱 회귀로 와인 분류하기
```
import pandas as pd
wine = pd.read_csv('htt... | github_jupyter |
```
%%html
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<style>#notebook-container{font-size: 13pt;font-family:'Open Sans', sans-serif;} div.text_cell{max-width: 104ex;}</style>
%pylab inline
```
# 2D Rendering
To render in 2D we will be using vectors with $(x, y)$ coordinates. We... | github_jupyter |
```
import csv
import matplotlib
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
truncate_val = 180
bcbaseline_paths = ['/usr/local/google/home/abhishekunique/sim_franka/corl_data/20210616-00h38m-final-baselineb-bcwindow3-evalwithgoalreaching-2elements/test-0/test-0/06-16-dev-example-awac-script/... | github_jupyter |
# Fine-mapping with PolyFun
## Aim
The purpose of this notebook ipmlements commands for [a functionally-informed fine-mapping workflow using the PolyFun method](https://github.com/omerwe/polyfun/wiki).
## Methods Overview
`PolyFun` offers the following features:
1. Using and/or creating Functional Annotations
2. ... | github_jupyter |
##### Copyright © 2020 The TensorFlow Authors.
<font size=-1>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](https://www.apache.org/licenses/LICE... | github_jupyter |
# Gaussian process regression in PyMC
Author: [Nipun Batra](https://nipunbatra.github.io/)
```
import numpy as np
import matplotlib.pyplot as plt
import pymc3 as pm
from matplotlib import rc
import arviz as az
import warnings
warnings.filterwarnings('ignore')
rc('font', size=16)
```
We will use PyMC to do Gaussian ... | github_jupyter |
# `006-compute-grad`
Task: compute the gradient of a function
## Setup
```
import torch
from torch import tensor
import matplotlib.pyplot as plt
%matplotlib inline
```
## Task
Suppose we have a dataset with just a single feature `x` and continuous outcome variable `y`.
```
torch.manual_seed(0)
x = torch.rand(100)... | github_jupyter |
# To make a better wedge
This notebook is an update to the notebook entitled "To make a wedge" featured in the blog post, [To make a wedge](https://agilescientific.com/blog/2013/12/12/to-make-a-wedge.html?rq=wedge), on December 12, 2013.
Start by importing Numpy and Matplotlib's pyplot module in the usual way:
```
i... | github_jupyter |
### Reconstruction with a custom network.
This notebook extends the last notebook to simultaneously train a decoder network, which translates from embedding back into dataspace. It also shows you how to use validation data for the reconstruction network during training.
### load data
```
import tensorflow as tf
tf._... | github_jupyter |
<a href="https://colab.research.google.com/github/yohanesnuwara/geostatistics/blob/main/project_notebooks/gullfaks_python.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
i... | github_jupyter |
### License
Copyright 2021 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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | github_jupyter |
```
import matplotlib
matplotlib.use('Agg')
%matplotlib inline
import matplotlib.pyplot as plt
# plt.switch_backend('Agg')
plt.rcParams['image.cmap'] = 'gray'
import numpy as np
import os
from glob import glob
#import nrrd
import numpy as np
import SimpleITK as sitk
SMALL_SIZE = 14
MEDIUM_SIZE = 16
BIGGER_SIZE = 18
p... | github_jupyter |
```
%matplotlib inline
```
Training a Classifier
=====================
This is it. You have seen how to define neural networks, compute loss and make
updates to the weights of the network.
Now you might be thinking,
What about data?
----------------
Generally, when you have to deal with image, text, audio or vide... | github_jupyter |
**[Python Home Page](https://www.kaggle.com/learn/python)**
---
# Try It Yourself
Think you are ready to use Booleans and Conditionals? Try it yourself and find out.
To get started, **run the setup code below** before writing your own code (and if you leave this notebook and come back later, don't forget to run the... | github_jupyter |
```
#Import Libraries
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from sklearn.metrics import median_absolute_error
#----------------------------------------------------
#Applying Linear Regression Model
LinearRegr... | github_jupyter |
```
# Imports
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import networkx as nx
import osmnx as ox
import geopandas as gpd
import itertools
import time
import random
import ast
# Utils & Functions
from utils import *
from hrga import *
from tndp import *
from export import *
from plot import ... | github_jupyter |
**此文件用于数据的预处理**
```
import os
print('user_artist_data.txt 中数据行数:')
print(os.popen('cat user_artist_data.txt | wc -l').read())
print('user_artist_data.txt 中数据格式')
print(os.popen('head -5 user_artist_data.txt').read())
```
可以看到`user_artist_data.txt`中共有2400万条数据,其合法的格式应该为`user_id artist_id times`,所以我们利用shell脚本统计一下合理的格式的... | github_jupyter |
```
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import pandas as pd
import nltk.classify.util
from nltk.corpus import stopwords
from nltk.corpus import wordnet
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
#!pip install textblob
from textblob import TextBlob
... | github_jupyter |
# 多策略, 多品种回测示例
```
from collections import defaultdict
import OnePy as op
from OnePy.custom_module.cleaner_talib import Talib
from OnePy.custom_module.cleaner_sma import SMA
class SmaStrategy(op.StrategyBase):
def __init__(self):
super().__init__()
self.sma1 = SMA(3, 40).calculate
self.... | github_jupyter |
```
import numpy as np
import ngmix
import matplotlib.pyplot as plt
import piff
import galsim
import seaborn as sns
import piff
%matplotlib notebook
%load_ext autoreload
%autoreload 2
from matts_misc.piff_wl_sims.des_piff import DES_Piff
%%time
psf_model = DES_Piff(
file_name="/Users/Matt/DESDATA/y3_piff/y3a1... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.