text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
```
# Create figures in Python that handle LaTeX, and save images to files in my
# preferred formatting. I typically place this code in the root of each of my
# projects, and import using:
# from latexify import *
# which will also run the latexify() function on the import.
# Based on code from https://nipunbatra.git... | github_jupyter |
```
#!/usr/bin/env python
# coding=utf-8
# Copyright 2020 The HuggingFace Team All rights reserved.
#
# 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/LICE... | github_jupyter |
<link rel="stylesheet" href="../../styles/theme_style.css">
<!--link rel="stylesheet" href="../../styles/header_style.css"-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<table width="100%">
<tr>
<td id="image_td" width="15%" class="head... | github_jupyter |
# 📃 Solution for Exercise M7.03
As with the classification metrics exercise, we will evaluate the regression
metrics within a cross-validation framework to get familiar with the syntax.
We will use the Ames house prices dataset.
```
import pandas as pd
import numpy as np
ames_housing = pd.read_csv("../datasets/hou... | github_jupyter |
```
## notebookの表示領域広げる
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:90% !important; }</style>"))
## 描画できるようにする&綺麗に描画できるようにする
%matplotlib inline
import matplotlib.pyplot as plt
%config InlineBackend.figure_formats = {'png', 'retina'}
## 自動で時間表示する
%load_ext autotime
## ライブラリの... | github_jupyter |
```
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
import galah_li_rich_selection
import getpass
import mpl_scatter_density
from matplotlib.colors import LogNorm
import seaborn as sns
import matplotlib as mpl
import matplotlib.cm as cm
import h5py
import os
username = getpass.getuser()
... | github_jupyter |
<a href="https://colab.research.google.com/github/rifkybujana/KOPSI/blob/main/notebook/Squad.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Copyright 2021 Rifky Bujana Bisri & Muhammad Fajrin Buyang Daffa
Licensed under the Apache License, Version... | github_jupyter |
```
import numpy as np
import pandas as pd
from os import listdir
from rdkit import Chem
from scipy.spatial.distance import cdist
from itertools import product
from rdkit.ML.Descriptors.MoleculeDescriptors import MolecularDescriptorCalculator
```
### Loading useful data
### For ECIF
```
# Possible predefined protein... | github_jupyter |
# EDA
path_plot = '/home/petra42/GIT/aida_question_classification/plots/'
## Libaries
```
import pandas as pd
import numpy as np
from collections import Counter
#visualisation
import matplotlib.pyplot as plt
import seaborn as sns
#nltk import für eda_1 - preprozessing dataframe
import re
import nltk
from nltk.co... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
%matplotlib inline
from pathlib import Path
import json
import sys
sys.path.append("../")
import anamic
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tifffile
from scipy import ndimage
import read_roi
from tqdm.auto import trange
from tqdm.auto i... | github_jupyter |
```
import numpy as np
import csv, gzip, os, sys, gc
import math
import torch
from torch import nn
import torch.optim as optim
from torch.nn import functional as F
import logging
import datetime
import optparse
import pandas as pd
import os
from sklearn.metrics import log_loss
import ast
from torch.utils.data import D... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Training, hyperparameter tune, and deploy with PyTorch Lightning
## Introduction:
## Prerequisite:
* Understand the [architecture and terms](https://docs.microsoft.com/azure/machine-learning/service/concept-azure-machine-lea... | github_jupyter |
#Waymo Open Dataset Tutorial
- Website: https://waymo.com/open
- GitHub: https://github.com/waymo-research/waymo-open-dataset
This tutorial demonstrates how to use the Waymo Open Dataset with two frames of data. Visit the [Waymo Open Dataset Website](https://waymo.com/open) to download the full dataset.
To use, open... | github_jupyter |
## DataFrames
Consider DataFrame as a combination of Series objects put together to share the same index.
```
import pandas as pd
import numpy as np
df = pd.DataFrame([[10,20,30],[50,60,70], [20,30,40]],columns=['Col1','Col2', 'Col3'])
df
df.columns # to get the column names
df.dtypes
df.index = ["R1","R2","R3"]
df
... | github_jupyter |
## Export Data Script "Blanket Script"
This script searches for ArcGIS Online feature layers and exports them as a geodatabase on ArcGIS Online. This script is based on a system-wide backup script and utilizes a keyword search function to archive data.
To start running the script, you can click Run at the top to run t... | github_jupyter |
#Environment Setup
```
from google.colab import drive
drive.mount('/content/drive')
```
#Put Data in DataFrame (Articles)
```
import pandas as pd
path = "PATH/TO/DATASETS" # Place dataset path here
import glob, os
dfFalse = pd.read_csv(path+"NewsFakeCOVID-19.csv", usecols=['title'])
dfFalse['label']=0
dfFalseJuly =... | github_jupyter |
<a href="https://www.bigdatauniversity.com"><img src="https://ibm.box.com/shared/static/cw2c7r3o20w9zn8gkecaeyjhgw3xdgbj.png" width="400" align="center"></a>
<h1><center>K-Nearest Neighbors</center></h1>
In this Lab you will load a customer dataset, fit the data, and use K-Nearest Neighbors to predict a data point. B... | github_jupyter |
# Regression Week 4: Ridge Regression (gradient descent)
In this notebook, you will implement ridge regression via gradient descent. You will:
* Convert an SFrame into a Numpy array
* Write a Numpy function to compute the derivative of the regression weights with respect to a single feature
* Write gradient descent fu... | github_jupyter |
## Title: Spatial Database of Planted Trees (SDPT)
### Description
The Spatial Database of Planted Trees (SDPT) was compiled by Global Forest Watch using data obtained from national governments, non-governmental organizations and independent researchers. Data were compiled for 82 countries around the world, with most ... | github_jupyter |
# Bayesian Optimization with Random Forests (SMAC)
## Optimizing a CNN with Scikit-Optimize
In this notebook, we will use **Bayesian Optimization** to select the best **hyperparameters** for a CNN that recognizes digits in images, using the MNIST dataset and the open source Python package [Scikit-Optimize](https://sc... | github_jupyter |
# Leverage
Make sure to watch the video and slides for this lecture for the full explanation!
$ Leverage Ratio = \frac{Debt + Capital Base}{Capital Base}$
## Leverage from Algorithm
Make sure to watch the video for this! Basically run this and grab your own backtestid as shown in the video. More info:
The get_back... | github_jupyter |
[[source]](../api/alibi.confidence.model_linearity.rst)
# Measuring the linearity of machine learning models
## Overview
Machine learning models include in general linear and non-linear operations: neural networks may include several layers consisting of linear algebra operations followed by non-linear activation fu... | github_jupyter |
```
!pip install pandas
import pandas as pd
import numpy as np
import gc
data_click = pd.read_csv('../train_preliminary/click_log.csv')# click_log
data_user = pd.read_csv('../train_preliminary/user.csv') # user
data_ad = pd.read_csv('../train_preliminary/ad.csv') # user
data_click = data_click.merge(data_ad... | github_jupyter |
# 12 - Introduction to Deep Learning
by [Alejandro Correa Bahnsen](albahnsen.com/)
version 0.1, May 2016
## Part of the class [Machine Learning for Security Informatics](https://github.com/albahnsen/ML_SecurityInformatics)
This notebook is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported Lic... | github_jupyter |
```
#Applying transfer learning for horses and humans
#Importing the libraries
import os
import zipfile
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/ince... | github_jupyter |
# Laboratory 09 - Digital and IR Imaging
## MAE 3120, Spring 2020
## Grading Rubric
Procedures, Results, Plots, Tables - 60%
Discussion Questions - 30%
Neatness - 10%
## Introduction and Background
Due to this special semester and the abundance of snow days, this lab is created to introduce you to some advanced ... | github_jupyter |
# License
***
Copyright (C) 2017 J. Patrick Hall, jphall@gwu.edu
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,... | github_jupyter |
# Analyze a large dataset with Google BigQuery
**Learning Objectives**
1. Access an ecommerce dataset
1. Look at the dataset metadata
1. Remove duplicate entries
1. Write and execute queries
## Introduction
BigQuery is Google's fully managed, NoOps, low cost analytics database. With BigQuery you can query terabyte... | github_jupyter |
<IMG SRC="https://avatars2.githubusercontent.com/u/31697400?s=400&u=a5a6fc31ec93c07853dd53835936fd90c44f7483&v=4" WIDTH=125 ALIGN="right">
# GIS
This notebook shows how to export model data so it can be viewed in GIS (QGIS or ArcMAP).
### Contents<a name="TOC"></a>
1. [Model types](#modeltypes)
2. [Export vector da... | github_jupyter |
# 11장. 레이블되지 않은 데이터 다루기 : 군집 분석
**아래 링크를 통해 이 노트북을 주피터 노트북 뷰어(nbviewer.jupyter.org)로 보거나 구글 코랩(colab.research.google.com)에서 실행할 수 있습니다.**
<table class="tfo-notebook-buttons" align="left">
<td>
<a target="_blank" href="https://nbviewer.jupyter.org/github/rickiepark/python-machine-learning-book-2nd-edition/blob/m... | github_jupyter |
# Library
```
import tensorflow as tf
import numpy as np
import os
import glob
import pandas as pd
import PIL
import gc
from PIL import Image
print(f'Numpy version : {np.__version__}')
print(f'Pandas version : {pd.__version__}')
print(f'Tensorflow version : {tf.__version__}')
print(f'Pillow version : {PIL.__version__... | github_jupyter |
# Numerical Hydrodynamics Assignment
The numerical assignment consists of a short group report on a marine geometry. Your group name indicates which geometry to use, but if your group would prefer to work on a bespoke geometry, come talk to me.
Individuals in the group will have their mark reduced for failing to comp... | 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 |
# Song Gathering
**JC Nacpil 2021/09/06**
In this notebook, we will build a database of Kpop songs with audio features using the Spotify Web API and Spotipy package. The output files will be used for `KpopSongRecommender`.
## Set-up
### Importing libraries
```
# Library for accessing Spotify API
import spotipy
im... | github_jupyter |
```
import numpy as np
import json
from keras.models import Model
from keras.layers import Input
from keras.layers.convolutional import Conv2D
from keras.layers.pooling import MaxPooling2D, AveragePooling2D
from keras.layers.normalization import BatchNormalization
from keras import backend as K
def format_decimal(arr, ... | github_jupyter |
```
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import time
np.set_printoptions(precision=4, linewidth=200)
%load_ext autoreload
%autoreload 2
%matplotlib inline
print(tf.__version__)
from utils.reader import ptb_raw_data
from utils.batcher import ptb_batcher
from utils.conditional_scop... | github_jupyter |
<table width="100%"> <tr>
<td style="background-color:#ffffff;">
<a href="http://qworld.lu.lv" target="_blank"><img src="../images/qworld.jpg" width="35%" align="left"> </a></td>
<td style="background-color:#ffffff;vertical-align:bottom;text-align:right;">
prepared by Abuzer Yak... | github_jupyter |
```
import xarray as xr
import pandas as pd
import numpy as np
from os.path import join, basename
%matplotlib inline
import matplotlib as mpl
# mpl.rcParams.keys()
import matplotlib.pyplot as plt
import seaborn as sns
rc = {'savefig.bbox': 'tight', 'savefig.format': 'png', 'savefig.dpi':300}
context = 'paper'# 'talk'
... | github_jupyter |
# SHAP
[SHAP](https://github.com/slundberg/shap)'s goal is to explain machine learning output using a game theoretic approach. A primary use of SHAP is to understand how variables and values influence predictions visually and quantitatively. The API of SHAP is built along the `explainers`. These explainers are appropr... | github_jupyter |
```
import numpy as np
import random
from math import *
import time
import copy
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.optim.lr_scheduler import StepLR, MultiStepLR
torch.cuda.set_device(1)
torch.set_default_tensor_... | github_jupyter |
# Paired programming activity
For this activity, work with your partner to write code to answer these questions. If you're stuck, put up a pink sticky. Feel free to do the questions out of order if you want.
For each question, you can try different values for the input to see if your code is right!
**Question 1:** G... | github_jupyter |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/5_exploring_model_families/4_resnet/1.3)%20Intro%20to%20resnet50-v1%20network%20-%20mxnet%20backend.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.s... | github_jupyter |
# Minimum inter-class distances for different norms and different datasets
```
import os
os.chdir("../")
import sys
import json
import math
import numpy as np
import pickle
from PIL import Image
from sklearn import metrics
from sklearn.metrics import pairwise_distances as dist
import matplotlib.pyplot as plt
import se... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_parent" href="https://github.com/giswqs/geemap/tree/master/tutorials/Image/02_image_visualization.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_parent" href=... | github_jupyter |
# Exploring OpenEEW data
## Import openeew package
```
from openeew.data.aws import AwsDataClient
from openeew.data.df import get_df_from_records
```
## Import other packages
```
import folium
from datetime import datetime
import plotnine as pn
import pandas as pd
from geopy.distance import distance
# Allow nested... | github_jupyter |
```
import os
os.environ["CUDA_VISIBLE_DEVICES"]="1"
os.environ["TF_FORCE_GPU_ALLOW_GROWTH"]="true"
import numpy as np
from matplotlib import pyplot as plt
import tensorflow as tf
from tqdm import tqdm
tf.compat.v1.enable_v2_behavior()
from tf_agents.agents.ppo import ppo_agent
from tf_agents.drivers import dynamic_ste... | github_jupyter |
```
import time
import numpy as np
import scipy as sc
import bsplines as bsp
import HyCho_FEM as fem
import HyCho_PIC
#import HyCho_PIC as pic
import utilitis_opt as utils_opt
import utilitis_pic_Rel
#import utilitis_pic_Rel as utils_pic_fast
import matplotlib.pyplot as plt
from scipy.sparse.linalg import splu
f... | github_jupyter |
# **Grammar Error Correction using BERT**
***Use of BERT Masked Language Model (MLM) for Grammar Error Correction (GEC), without the use of annotated data***
Sunil Chomal | sunilchomal@gmail.com
```
%%html
<img src='/nbextensions/google.colab/GEC.png' />
```
**High level workflow**
• Tokenize the sentence using... | github_jupyter |
# _*Max-Cut and Traveling Salesman Problem*_
## Introduction
Many problems in quantitative fields such as finance and engineering are optimization problems. Optimization problems lie at the core of complex decision-making and definition of strategies.
Optimization (or combinatorial optimization) means searching for... | github_jupyter |
ERROR: type should be string, got "https://www.kaggle.com/muzzzdy/sms-spam-detection-with-various-classifiers\n\nhttps://machinelearningmastery.com/use-word-embedding-layers-deep-learning-keras/\n\n```\nimport numpy as np\n\nfrom google.colab import drive\ndrive.mount(\"/content/drive\")\n```\n\n###data examination\n\n```\n%cd \"/content/drive/My Drive\"\n!ls\nimport pandas\n\nmydata = pandas.read_csv(\"spam.csv\",encoding=\"latin-1\")\n\nmydata.head()\nmydata = mydata.drop(labels=[\"Unnamed: 2\",\"Unnamed: 3\",\"Unnamed: 4\"],axis=1)\n\n\nmydata = mydata.rename(columns = {\"v1\":\"label\",\"v2\":\"inp\"})\nmydata.describe()\n\nmydata[\"length\"] = mydata[\"inp\"].apply(len)\nmydata.head()\n\nimport matplotlib as mat\n\nmat.rcParams[\"patch.force_edgecolor\"] = True\nmat.pyplot.style.use(\"seaborn-bright\")\nmydata.hist(column=\"length\",by=\"label\",bins=50,figsize=(8,3))\n\n\nmydata['label'] = mydata['label'].astype('category')\nmydata['label'].cat.codes.corr(mydata['length'])\n\n\nmydata['label'].value_counts()/mydata.shape[0]\n```\n\n### preprocessing\n\n```\nimport string\n\ndef text_process(text):\n text = text.translate(str.maketrans('','',string.punctuation))\n text = [word.lower() for word in text.split()]\n\n return \" \".join(text)\ninpcol = mydata['inp'].copy()\npreprocessed = inpcol.apply(text_process)\npreprocessed[0]\nmaxlen = 0 \nfor document in preprocessed:\n document_len = len(document.split())\n if document_len>maxlen:\n maxlen = document_len\n\nprint(maxlen)\nprint(document.split())\nfrom keras.preprocessing.text import one_hot\n\nvocab_size = 20000\nencoded_docs = [one_hot(document,vocab_size) for document in preprocessed]\nprint(encoded_docs[0])\nfrom keras.preprocessing.sequence import pad_sequences\n\npadded_docs = pad_sequences(encoded_docs,maxlen=maxlen, padding = 'post')\nprint(padded_docs)\nprint(np.shape(padded_docs))\n\nmydata2 = []\n\n\nfor i in range(len(mydata)):\n myex = [None,None]\n myex[0] = padded_docs[i]\n\n if mydata.loc[i][0] == 'ham':\n myex[1] = 0\n elif mydata.loc[i][0] == 'spam':\n myex[1] = 1\n \n mydata2.append(myex)\nprint(np.shape(mydata2))\nprint(mydata2[0])\n```\n\n###Network\n\n```\nfrom sklearn.model_selection import train_test_split\nxtrain, xtest, ytrain, ytest = train_test_split(padded_docs[:],\n np.array(mydata2)[:,1],\n test_size = 0.3,\n random_state = 22)\nprint(np.shape(xtrain),np.shape(ytrain))\nxtrain[0]\n#from keras.optimizers import Adam\n#myopt = Adam(lr=0.00001)\nfrom keras.layers import LSTM, BatchNormalization, Dropout, Input, Dense, Embedding, Flatten\nfrom keras.models import Sequential\n\n\n\n\nmodel = Sequential()\n\nmodel.add(Embedding(vocab_size, 512,input_length=maxlen))\nmodel.add(Flatten())\nmodel.add(Dense(64))\nmodel.add(Dense(1,activation='sigmoid'))\nmodel.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['acc'])\n\nmodel.fit(xtrain,ytrain,epochs=100,batch_size=128,validation_split=0.3)\n```\n\n" | github_jupyter |
# Redshift ML BYOM Remote Inference using Amazon SageMaker Random Cut Forests
_**Run Predictions from your Amazon Redshift cluster on a model trained and deployed on Amazon Sagemaker**_
---
---
## Contents
1. [Introduction](#Introduction)
2. [Setup Parameters](#Setup-Parameters)
3. [Training](#Training)
4. [Infer... | github_jupyter |
# Midterm Exam 02
- This is a closed book exam
- You should only ever have a SINGLE browser tab open
- The exam lasts 75 minutes, and Sakai will not accept late submissions
- You may use the following:
- TAB completion
- SHIFT-TAB completion for function arguments
- help(func), `?func`, `func?` to get hel... | github_jupyter |
#### New to Plotly?
Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).
<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo... | github_jupyter |
# Introduction to XGBoost-Spark Cross Validation with GPU
The goal of this notebook is to show you how to levarage GPU to accelerate XGBoost spark cross validatoin for hyperparameter tuning. The best model for the given hyperparameters will be returned.
Here takes the application 'Taxi' as an example.
A few librarie... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Vectors/us_census_counties.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_... | github_jupyter |
# Analyzing patient data (extended version)
## Preliminaries
Load the required modules.
## Data set description
The data consists of two spreadsheets.
The first is data on patients gathered during an experimental trial. The patients' temperature is measured at one-hour intervals, and each hour, the patients recei... | github_jupyter |
# Convolutional Neural Networks
(c) Deniz Yuret, 2018
* Objectives: See the effect of sparse and shared weights implemented by convolutional networks.
* Prerequisites: MLP models (04.mlp.ipynb), KnetArray, param, param0, dropout, relu, nll
* Knet: conv4, pool, mat (explained)
* Knet: dir, gpu, minibatch, KnetArray (us... | github_jupyter |
```
import copy
from functools import reduce
import pandas as pd
from typing import List, Tuple
import pandas as pd
from matplotlib import pyplot as plt
import mpl_finance as mpf
with open('./resources/ticks/last_file.csv', 'r', encoding='utf-8') as f:
prices = f.readlines()
with open('./resources/ticks/volume.csv'... | github_jupyter |
# Capture camera stream
```
%%html
<div>
<button id='button-record'>Start Recording</button>
</div>
<video muted autoplay loop controls style='visibility:hidden' id='player'></video>
<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script>
<script>
function upload(blob) {
var reader = ne... | github_jupyter |
People always ask: "can you randomize several times and use the proportion of selection, instead of
just one randomization"?
Let's try to figure this out.
```
import numpy as np
import regreg.api as rr
import seaborn as sns
%matplotlib inline
%load_ext rpy2.ipython
import matplotlib.pyplot as plt
import scipy.stats... | github_jupyter |
# **🛠 CenterNet Fixed For Google Colab**
[Docs](https://mehrdad-dev.ir/CenterNet-Fixed-For-Colab/)
[GitHub](https://github.com/mehrdad-dev/CenterNet-Fixed-For-Colab)
## **Clone CenterNet**
```
! git clone https://github.com/mehrdad-dev/CenterNet-Fixed-For-Colab.git
```
## **Install Conda**
```
! wget https://rep... | github_jupyter |
<font color=gray>Oracle Cloud Infrastructure Data Science Demo Notebook
Copyright (c) 2021 Oracle, Inc.<br>
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
</font>
# Validation of the CNN Model
```
%load_ext autoreload
%autoreload 2
import keras
from keras.mod... | github_jupyter |
# The inverted pendulum model of the human standing
Marcos Duarte
Despite the enormous complexity of the human body, part of the mechanical behavior of the human body during the standing still posture, namely the displacements of the center of gravity ($COG$) and center of pressure ($COP$) in the anterior-posterior d... | github_jupyter |
# Overfitting demo
## Create a dataset based on a true sinusoidal relationship
Let's look at a synthetic dataset consisting of 30 points drawn from the sinusoid $y = \sin(4x)$:
```
import graphlab
import math
import random
import numpy
from matplotlib import pyplot as plt
%matplotlib inline
```
Create random values ... | github_jupyter |
# Warm-up
1. Review this code for 1 minute, then:
1. Identify how an "Electric-type" Pokemon object would get access to its base statistics
1. Attempt to write a method for `Electric` that will check its `HP` after every action
<img src='../assets/inherit_warmup.png' width=500 align='left' />
---
# Learning O... | github_jupyter |
```
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
```
# Embedding CPLEX in a ML Spark Pipeline
`Spark ML` provides a uniform set of high-level APIs that help users create and tune practical machine learning pipelines.
In this notebook, we show how... | github_jupyter |
# CBOE VXN Index
In this notebook, we'll take a look at the CBOE VXN Index dataset, available on the [Quantopian Store](https://www.quantopian.com/store). This dataset spans 02 Feb 2001 through the current day. This data has a daily frequency. CBOE VXN measures market expectations of near-term volatility conveyed by N... | github_jupyter |
```
# look at tools/set_up_magics.ipynb
yandex_metrica_allowed = True ; get_ipython().run_cell('# one_liner_str\n\nget_ipython().run_cell_magic(\'javascript\', \'\', \n \'// setup cpp code highlighting\\n\'\n \'IPython.CodeCell.options_default.highlight_modes["text/x-c++src"] = {\\\'reg\\\':[/^%%cpp/]} ;\'\n \... | github_jupyter |
# WIP: Comparing ICESat-2 Altimetry Elevations with DEM
This notebook compares elevations from ICESat-2 to those from a DEM.
Note that this notebook was created for a specific event using not-publicly available files.
Thus, it is provided as an example workflow but needs to be updated to use a public DEM and icepyx da... | github_jupyter |
```
from imctools.converters import ome2analysis
from imctools.converters import ome2histocat
from imctools.converters import mcdfolder2imcfolder
from imctools.converters import exportacquisitioncsv
import sys
print(sys.path)
print(sys.executable)
import os
import pathlib
import shutil
import re
```
# The IMC preproc... | github_jupyter |
```
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from chmp.bayes import Model, sample_latent, sample_prior
from chmp.ds import mpl_set, get_color_cycle, colormap, define
from chmp.experiment import Loop
from chmp.ml import get_variables, Sample
```
# Implicit Variation... | github_jupyter |

This notebook shows how **CKG** can be used to download data from the Proteomics Identifications Database - PRIDE - (https://www.ebi.ac.uk/pride/) and quickly formated to start analyzing them with the functionality in the analytics core.
```
import os
i... | github_jupyter |
# Two showcases of fraud detection models
The prospective fraud detection model will comprise of the order of ten separate fraud detection models. This document is meant to describe in some detail two such models to get an idea of how these models work, what they do with the data and what they result in.
Both models ... | github_jupyter |
# 206 Optimizers
View more, visit my tutorial page: https://morvanzhou.github.io/tutorials/
My Youtube Channel: https://www.youtube.com/user/MorvanZhou
Dependencies:
* torch: 0.1.11
* matplotlib
```
import torch
import torch.utils.data as Data
import torch.nn.functional as F
from torch.autograd import Variable
impor... | github_jupyter |
# Project 5: NLP on Financial Statements
## Instructions
Each problem consists of a function to implement and instructions on how to implement the function. The parts of the function that need to be implemented are marked with a `# TODO` comment. After implementing the function, run the cell to test it against the uni... | github_jupyter |
#### Training Sample: train.csv with undersampling
#### Evaluation Sample: validation_under.csv
#### Method: OOB
#### Output: Best hyperparameters; Pr-curve; ROC AUC
# Training Part
```
from imblearn.over_sampling import RandomOverSampler
from imblearn.under_sampling import RandomUnderSampler
import numpy as np
impor... | github_jupyter |
# 05 - Data Preparation and Advanced Model Evaluation
by [Alejandro Correa Bahnsen](http://www.albahnsen.com/) & [Iván Torroledo](http://www.ivantorroledo.com/)
version 1.3, June 2018
## Part of the class [Applied Deep Learning](https://github.com/albahnsen/AppliedDeepLearningClass)
This notebook is licensed under... | github_jupyter |
```
from pymongo import MongoClient
client = MongoClient('mongodb+srv://AmazonianSentiments:6pVOMaDeacyVgrre@amazoniansentiments.duy3v.mongodb.net/AmazonianSentiments?retryWrites=true&w=majority')
mydb = client["AmazonianSentiments"] #pyramids is the database
mycol = mydb["AllBeauty"] #invoice is the collection
import... | github_jupyter |
```
#### Weights from Michael Guerzhoy and Davi Frossard
# http://www.cs.toronto.edu/~guerzhoy/tf_alexnet/
import tensorflow as tf
import numpy as np
variable_data = np.load("saved_models/bvlc_alexnet.npy", encoding='bytes').item()
type(variable_data)
conv1_preW = variable_data["conv1"][0]
conv1_preb = variable_data["c... | github_jupyter |
## Title: Wood_Fiber_Concessions
### Description
“Wood fiber concession” refers to an area allocated by a government or other body for establishment of fast-growing tree plantations for the production of timber and wood pulp for paper and paper products.<br>
This data set displays wood fiber concessions as a single l... | github_jupyter |
# **Installing and Initializing Spark on Google Colab**
```
!apt-get install openjdk-8-jdk-headless -qq > /dev/null
!wget -q https://downloads.apache.org/spark/spark-3.0.2/spark-3.0.2-bin-hadoop2.7.tgz
!tar xf spark-3.0.2-bin-hadoop2.7.tgz
!pip install -q findspark
import os
os.environ["JAVA_HOME"] = "/usr/lib/jvm/... | github_jupyter |
```
import numpy as np
from cluster_algorithms import base_kmeans
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import silhouette_score, davies_bouldin_score, calinski_harabasz_score
from scipy.spatial import Voronoi, voron... | github_jupyter |
##### Copyright 2020 Google
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | github_jupyter |
<center>
<img src="https://gitlab.com/ibm/skills-network/courses/placeholder101/-/raw/master/labs/module%201/images/IDSNlogo.png" width="300" alt="cognitiveclass.ai logo" />
</center>
# **Data Wrangling Lab**
Estimated time needed: **45 to 60** minutes
In this assignment you will be performing data wrangling.
... | github_jupyter |
# Hail workshop
This notebook will introduce the following concepts:
- Using Jupyter notebooks effectively
- Loading genetic data into Hail
- General-purpose data exploration functionality
- Plotting functionality
- Quality control of sequencing data
- Running a Genome-Wide Association Study (GWAS)
- Rare vari... | github_jupyter |
# Getting started with DoWhy: A simple example
This is a quick introduction to the DoWhy causal inference library.
We will load in a sample dataset and estimate the causal effect of a (pre-specified)treatment variable on a (pre-specified) outcome variable.
First, let us load all required packages.
```
import numpy as... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
```
## Mamiraua Dataset Plot
```
lag = 512 # [32, 64, 128, 256, 512
base = pd.read_pickle('../pkl_datasets/mamiraua_dataset_ACF_' + str(lag) + '.gzip')
cotas = pd.read_csv('./boundary_files/Cotas_HxC_bins_' + str(int(lag)) ... | github_jupyter |
This notebook shows you how to visualize the changes in ozone and particulate matter from different runs of CCTM. Note that you must first run the `combine` program distributed with CMAQ for the files here to exist. The need for postprocessing of CCTM outputs is explained in [this section](https://github.com/USEPA/CMAQ... | github_jupyter |
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import metrics
from sklearn.metrics import pairwise_distances
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn import cluster
from sklearn import preprocessing
```
## Overall principal of iterated fea... | github_jupyter |
# 集成方法: ensemble method(元算法: meta algorithm) 概述
* 概念: 是对其他算法进行组合的一种形式。
* 集成方法:
1.投票选举(bagging: 自举汇聚法 bootstrap aggregating): 是基于数据随机重抽样分类器构造的方法
2.再学习(boosting): 是基于所有分类器的加权求和的方法
## bagging和boosting的区别是什么?
1.bagging 是一种与 boosting 很类似的技术, 所使用的多个分类器的类型(数据量和特征量)都是一致的。
2.bagging 是由**不同的分类器**(1.数据随机化 2.特... | github_jupyter |
# Laboratory 06 - Temperature Measurement
## MAE 3120, Spring 2020
## Grading Rubric
Procedures, Results, Plots, Tables - 50%
Discussion Questions - 40%
Neatness - 10%
## Introduction and Background
Thermistors are temperature sensors whose resistance changes as the temperature changes. They are very accurate an... | github_jupyter |
```
%matplotlib inline
import pandas as pd
from IPython.core.display import HTML
css = open('style-table.css').read() + open('style-notebook.css').read()
HTML('<style>{}</style>'.format(css))
titles = pd.DataFrame.from_csv('data/titles.csv', index_col=None)
titles.head()
cast = pd.DataFrame.from_csv('data/cast.csv', in... | github_jupyter |
```
!pip uninstall sagemaker -y && pip install sagemaker
%%time
import pickle, gzip, urllib.request, json
import numpy as np
# Load the dataset
urllib.request.urlretrieve("http://deeplearning.net/data/mnist/mnist.pkl.gz", "mnist.pkl.gz")
with gzip.open('mnist.pkl.gz', 'rb') as f:
train_set, valid_set, test_set = ... | github_jupyter |
# Downloading Dependencies and Configuring your Environment
In this step we will be downloading tools, cloning sources from GitHub, and configuring your environment. These tools will be used in the remainder of this Tutorial. Some of the steps will require downloading packages to your host computer while some will be ... | github_jupyter |
```
%matplotlib inline
import pickle
import datetime
import time
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
data_path = "/workspace/dataset/"
train_file = "train_sample.csv"
dev_file = "dev_sample.csv"
test_file = "test_sample.csv"
train_df = pd.read_csv(data_path + train_file)
train_df.c... | github_jupyter |
```
import os
hostname = os.popen("hostname").read().split("\n")[0]
if(hostname != "reckoner1429-Predator-PH315-52" and hostname != "jarvis"):
from google.colab import drive
from google.colab import drive
drive.mount('/content/gdrive')
! chmod 755 "/content/gdrive/My Drive/collab-var.sh"
! "/conten... | github_jupyter |
---
title: "Data Science Design Pattern for Student Drop Out"
author: "Microsoft"
output:
rmarkdown::html_vignette:
toc: true
vignette: >
%\VignetteIndexEntry{Vignette Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```
knitr::opts_chunk$set(fig.width = 6,
... | github_jupyter |
```
import sys
sys.path.append("/mnt/home/TF_NEW/tf-transformers/src/")
# Install tf-transformers from github
import datasets
import json
import glob
import tensorflow as tf
import numpy as np
from tf_transformers.data import TFWriter, TFReader, TFProcessor
from tf_transformers.models import AlbertModel
from tf_transf... | github_jupyter |
# What are factor models?
By Evgenia "Jenny" Nitishinskaya and Delaney Granizo-Mackenzie
Notebook released under the Creative Commons Attribution 4.0 License.
---
(Linear) factor models try to express a rate of return of an asset $i$ in terms of some <i>factors</i> as
$$R_i = a_i + b_{i1} F_1 + b_{i2} F_2 + \ldots ... | github_jupyter |
# Numpy and Pandas Performance Comparison
[Goutham Balaraman](http://gouthamanbalaraman.com)
Pandas and Numpy are two packages that are core to a lot of data analysis. In this post I will compare the performance of numpy and pandas.
tl;dr:
- `numpy` consumes less memory compared to `pandas`
- `numpy` generally perfo... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.