code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
<!--NOTEBOOK_HEADER-->
*This notebook contains material from [Controlling Natural Watersheds](https://jckantor.github.io/Controlling-Natural-Watersheds);
content is available [on Github](https://github.com/jckantor/Controlling-Natural-Watersheds.git).*
<!--NAVIGATION-->
< [Control](http://nbviewer.jupyter.org/github/j... | github_jupyter |
# "Proof" of noise ceiling by simulation
```
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.model_selection import StratifiedKFold, cross_val_predict, GroupKFold
from sklearn.pipeline import make_pipeline
from sklear... | github_jupyter |
```
import numpy as np
from keras.preprocessing.image import img_to_array
from keras.preprocessing.image import load_img
import matplotlib.pyplot as plt
from pathlib import Path
from functools import partial
from PIL import Image
img = load_img('../data/91-image/t2.bmp')
x = img_to_array(img)
plt.imshow(x/255.)
plt.sh... | github_jupyter |
```
import gym
#import moviepy.editor as mpy
import os
from pyvirtualdisplay import Display
# Filter tensorflow version warnings
import os
# https://stackoverflow.com/questions/40426502/is-there-a-way-to-suppress-the-messages-tensorflow-prints/40426709
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # or any {'0', '1', '2'}
... | github_jupyter |
## CS536: Perceptrons
#### Done by - Vedant Choudhary, vc389
In the usual way, we need data that we can fit and analyze using perceptrons. Consider generating data points (X, Y) in the following way:
- For $i = 1,....,k-1$, let $X_i ~ N(0, 1)$ (i.e. each $X_i$ is an i.i.d. standard normal)
- For $i = k$, generate $X_k$... | github_jupyter |
```
# installs
# imports
import scipy.io
import cv2
from google.colab.patches import cv2_imshow
from skimage import io
import numpy as np
import pandas as pd
from PIL import Image
import matplotlib.pylab as plt
import pickle
from skimage import transform
from sklearn.model_selection import train_test_split
import tens... | github_jupyter |
Fashion-MNIST is a dataset of Zalando's article images—consisting of a training set of 60,000 examples and a test set of 10,000 examples. Each example is a 28x28 grayscale image, associated with a label from 10 classes. It shares the same image size and structure of training and testing splits.
- ## Try to build a cl... | github_jupyter |
##### Copyright 2018 Google LLC.
Licensed under the Apache License, Version 2.0 (the "License");
```
#@title Default title text
# 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... | github_jupyter |
# 5章 線形回帰
```
# 必要ライブラリの導入
!pip install japanize_matplotlib | tail -n 1
!pip install torchviz | tail -n 1
!pip install torchinfo | tail -n 1
# 必要ライブラリのインポート
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import japanize_matplotlib
from IPython.display import display
import torch
import torch.n... | github_jupyter |
```
import os
import numpy as np
np.set_printoptions(suppress=True)
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.ticker import LinearLocator
from matplotlib import gridspec
from pandas.plotting import register_matplotlib_converters
register_ma... | github_jupyter |
# XGBoost vs LightGBM
In this notebook we collect the results from all the experiments and reports the comparative difference between XGBoost and LightGBM
```
import matplotlib.pyplot as plt
import nbformat
import json
from toolz import pipe, juxt
import pandas as pd
import seaborn
from toolz import curry
from bokeh... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W3D3_NetworkCausality/W3D3_Tutorial3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Neuromatch Academy 2020 -- Week 3 Day 3 Tutorial 3
# Caus... | github_jupyter |
```
# Setup Sets
cities = ["C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9"]
power_plants = ["P1", "P2", "P3", "P4", "P5", "P6"]
connections = [("C1", "P1"), ("C1", "P3"), ("C1","P5"), \
("C2", "P1"), ("C2", "P2"), ("C2","P4"), \
("C3", "P2"), ("C3", "P3"), ("C3","P4"), \
... | github_jupyter |
# In-Class Coding Lab: Iterations
The goals of this lab are to help you to understand:
- How loops work.
- The difference between definite and indefinite loops, and when to use each.
- How to build an indefinite loop with complex exit conditions.
- How to create a program from a complex idea.
# Understanding Iterati... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import seaborn as sns
from Bio import SeqIO
import datasets
data_path = '../../data/PI_DataSet.tsv'
dataset_root = '../../datasets/'
results_root = '../../results/'
shuffle_stream = np.random.RandomState(seed = 1234)
df = pd.r... | github_jupyter |
```
import pandas as pd
disp_url = 'https://raw.githubusercontent.com/PacktWorkshops/The-Data-Science-Workshop/master/Chapter12/Dataset/disp.csv'
trans_url = 'https://raw.githubusercontent.com/PacktWorkshops/The-Data-Science-Workshop/master/Chapter12/Dataset/trans.csv'
account_url = 'https://raw.githubusercontent.com/P... | github_jupyter |
# Self-Driving Car Engineer Nanodegree
## Project: **Finding Lane Lines on the Road**
***
In this project, you will use the tools you learned about in the lesson to identify lane lines on the road. You can develop your pipeline on a series of individual images, and later apply the result to a video stream (really j... | github_jupyter |
# TensorFlow Transfer Learning
This notebook shows how to use pre-trained models from [TensorFlowHub](https://www.tensorflow.org/hub). Sometimes, there is not enough data, computational resources, or time to train a model from scratch to solve a particular problem. We'll use a pre-trained model to classify flowers wit... | github_jupyter |
```
import os
import sys
import time
import matplotlib.pyplot as plt
import numpy as np
import GCode
import GRBL
# Flip a 2D array. Effectively reversing the path.
flip2 = np.array([
[0, 1],
[1, 0],
])
flip2
# Flip a 2x3 array. Effectively reversing the path.
flip3 = np.array([
[0, 0, 1],
[0, 1, 0],
... | github_jupyter |
```
import pandas as pd
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
raw_data = pd.read_excel("hydrogen_test_classification.xlsx")
raw_data.head()
# 分开特征值和标签值
X = raw_data.drop("TRUE VALUE", axis=1).copy()
y = raw_data["TRUE VALUE"]
y.unique()
from sklearn.model_selection import train_test... | github_jupyter |
```
import os, csv
from pprint import pprint
from pathlib import Path
import pandas as pd
from pandas.errors import ParserError
pd.set_option('display.max_columns', 999)
from icecream import ic
from tqdm.notebook import tqdm#, tqdm_notebook
temp_csvs = Path('/media/share/store_240a/data_downloads/noaa_daily_avg_temps')... | github_jupyter |
# Supervised Learning
Supervised learning consists in learning the link between two datasets: the observed data X and an external variable y that we are trying to predict, usually called “target” or “labels”. Most often, y is a 1D array of length n_samples.
If the prediction task is to classify the observations in a ... | github_jupyter |
# Your first neural network
In this project, you'll build your first neural network and use it to predict daily bike rental ridership. We've provided some of the code, but left the implementation of the neural network up to you (for the most part). After you've submitted this project, feel free to explore the data and... | github_jupyter |
```
# Author: Robert Guthrie
from copy import copy
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.optim as optim
torch.manual_seed(1)
def argmax(vec):
# return the argmax as a python int
_, idx = torch.max(vec, 1)
return idx.item()
def prepare_sequence(seq, to_ix):
... | github_jupyter |
Lambda School Data Science
*Unit 2, Sprint 1, Module 3*
---
```
%%capture
import sys
# If you're on Colab:
if 'google.colab' in sys.modules:
DATA_PATH = 'https://raw.githubusercontent.com/LambdaSchool/DS-Unit-2-Applied-Modeling/master/data/'
!pip install category_encoders==2.*
# If you're working locally:
... | github_jupyter |
# Simple ARIMAX
This code template is for Time Series Analysis and Forecasting to make scientific predictions based on historical time stamped data with the help of ARIMAX algorithm
### Required Packages
```
import warnings
import numpy as np
import pandas as pd
import seaborn as se
import matplotlib.pyplot a... | github_jupyter |
```
%matplotlib inline
```
# STARmap processing example
This notebook demonstrates the processing of STARmap data using starfish. The
data we present here is a subset of the data used in this
[publication](https://doi.org/10.1126/science.aat5691) and was generously provided to us by the authors.
```
from pprint imp... | github_jupyter |
# Plotting with matplotlib
### Setup
```
%matplotlib inline
import numpy as np
import pandas as pd
pd.set_option('display.max_columns', 10)
pd.set_option('display.max_rows', 10)
```
### Getting the pop2019 DataFrame
```
csv ='../csvs/nc-est2019-agesex-res.csv'
pops = pd.read_csv(csv, usecols=['SEX', 'AGE', 'POPEST... | github_jupyter |
```
a =[]
import torch
from torch import nn
a = torch.rand(4,10,20)
b = torch.rand(4,10,20)
loss = nn.MSELoss()
[loss(x,y).item() for x,y in zip(a,b)]
import numpy as np
np.mean(list(range(10)))
np.std(list(range(10)))
np.quantile(list(range(10)),0.5)
import sys,os
sys.path.append(os.path.abspath('../'))
from models im... | github_jupyter |
<a href="https://colab.research.google.com/github/RihaChri/ImageClassificationBreastCancer/blob/main/CNNBreatCancer.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
import os
import glob
import cv2
import numpy as np
from sklearn.model_selection ... | github_jupyter |
```
# Import all libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings("ignore")
data = pd.read_csv('bank-marketing.csv')
data_copy = data.copy()
data.head()
Itemlist = []
for col in data.columns:
Itemlist.append([col, data[col... | github_jupyter |
```
import string
import random
from deap import base, creator, tools
## Create a Finess base class which is to be minimized
# weights is a tuple -sign tells to minimize, +1 to maximize
creator.create("FitnessMax", base.Fitness, weights=(1.0,))
```
This will define a class ```FitnessMax``` which inherits the Fitness... | github_jupyter |
<a href="https://colab.research.google.com/github/kumarikumari/Keras-Deep-Learning-Cookbook/blob/master/Sentiment_Analysis_Series_part_2(4000samplesonsent140).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.m... | github_jupyter |
# 06_Business_Insights
In this section, we will expend upon the features used by the model and attempt to explain its significance as well as contributions to the pricing model.
Accordingly, in Section Four, we identified the following key features that that are strong predictors of housing price based upon a combina... | github_jupyter |
# Bulk RNA-seq eQTL analysis
This notebook provide a command generator on the XQTL workflow so it can automate the work for data preprocessing and association testing on multiple data collection as proposed.
```
%preview ../images/eqtl_command.png
```
This master control notebook is mainly to serve the 8 tissues snu... | github_jupyter |
```
import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import plotly.plotly as py
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.graph_objs as go
init_notebook_mode(connected=True)
%matplotlib inline
data_folder = r'C:\Users\ocni\PycharmProjects... | github_jupyter |
# Artificial Intelligence Nanodegree
## Convolutional Neural Networks
---
In this notebook, we visualize four activation maps in a CNN layer.
### 1. Import the Image
```
import cv2
import scipy.misc
import matplotlib.pyplot as plt
%matplotlib inline
# TODO: Feel free to try out your own images here by changing i... | github_jupyter |
```
# Import All Libraries
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
import nltk
import re
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from sklearn.model_selection import train_test_split
from nltk... | github_jupyter |
# Part - 2: COVID-19 Time Series Analysis and Prediction using ML.Net framework
## COVID-19
- As per [Wiki](https://en.wikipedia.org/wiki/Coronavirus_disease_2019) **Coronavirus disease 2019** (**COVID-19**) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2). The disease wa... | github_jupyter |
[](https://colab.research.google.com/github/JohnSnowLabs/spark-nlp-workshop/blob/master/jupyter/transformers/HuggingFace%20in%20Spark%20NLP%20-%20RoBertaForTokenClassification.ipynb)
## Import RoBertaForTokenClassification models from HuggingFac... | github_jupyter |
# Section 2.1 `xarray`, `az.InferenceData`, and NetCDF for Markov Chain Monte Carlo
_How do we generate, store, and save Markov chain Monte Carlo results_
```
import numpy as np
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
import arviz as az
import pystan
import xarray as xr
from IP... | github_jupyter |
<a href="https://colab.research.google.com/github/NeuromatchAcademy/course-content/blob/master/tutorials/W1D1_ModelTypes/student/W1D1_Tutorial1.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Tutorial 1: "What" models
**Week 1, Day 1: Model Types*... | github_jupyter |
# Introduction
Try writing some **SELECT** statements of your own to explore a large dataset of air pollution measurements.
Run the cell below to set up the feedback system.
```
# Set up feedback system
from learntools.core import binder
binder.bind(globals())
from learntools.sql.ex2 import *
print("Setup Complete")... | github_jupyter |
# ETL Pipeline Preparation
Follow the instructions below to help you create your ETL pipeline.
### 1. Import libraries and load datasets.
- Import Python libraries
- Load `messages.csv` into a dataframe and inspect the first few lines.
- Load `categories.csv` into a dataframe and inspect the first few lines.
```
# imp... | github_jupyter |
# 选择
## 布尔类型、数值和表达式

- 注意:比较运算符的相等是两个等到,一个等到代表赋值
- 在Python中可以用整型0来代表False,其他数字来代表True
- 后面还会讲到 is 在判断语句中的用发
```
b=100
aa = eval(input('请输入密码: '))
bb = 123456
if aa == bb:
a = eval(input('请输入取多少钱: '))
if a <= b:
c = b-a
print('取钱成功')
b=c
print('余额',c)
# ... | github_jupyter |
# LOGISTIC REGRESSION WITH MNIST
```
import numpy as np
# import tensorflow as tf
import tensorflow.compat.v1 as tf
import matplotlib.pyplot as plt
# tf.disable_eager_execution()
# tf.enable_eager_execution()
print ("PACKAGES LOADED")
```
# DOWNLOAD AND EXTRACT MNIST DATASET
```
def OnehotEncoding(target):
from ... | github_jupyter |
[View in Colaboratory](https://colab.research.google.com/github/anaurora/WineClassification/blob/master/WineClassification.ipynb)
#Wine Type Prediction (Multi-class Classification)
This data set is taken from the UCI repository (link [here](https://archive.ics.uci.edu/ml/datasets/wine)). I have done some basic pre-pr... | github_jupyter |
```
import numpy as np
import pandas as pd
import json
import shap
import matplotlib.pyplot as plt
from matplotlib import rc
from colour import Color
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
import collections
import pickle
colors = ['#3f7f93','#da3b46','#F6AE2D', '#98b83b', '#825FC3']
cmp... | github_jupyter |
```
%load_ext autoreload
%autoreload 2
import pandas as pd
import time
from pandarallel import pandarallel
import math
import numpy as np
```
# Initialize pandarallel
```
pandarallel.initialize()
```
# DataFrame.apply
```
df_size = int(5e6)
df = pd.DataFrame(dict(a=np.random.randint(1, 8, df_size),
... | github_jupyter |
# What is the most popular start station and most popular end station?
```
#one
import csv
from pprint import pprint
"""This takes the file and returns dict of values. """
with open('chicago.csv', newline='') as csv_file:
reader = [{key: value for key, value in row.items()} #list comprehimsion or one liners ... | github_jupyter |
<a href="https://www.bigdatauniversity.com"><img src="https://ibm.box.com/shared/static/cw2c7r3o20w9zn8gkecaeyjhgw3xdgbj.png" width="400" align="center"></a>
<h1 align=center><font size="5"> SVM (Support Vector Machines)</font></h1>
In this notebook, you will use SVM (Support Vector Machines) to build and train a mod... | github_jupyter |
# Iteration
**CS1302 Introduction to Computer Programming**
___
```
%reload_ext mytutor
from ipywidgets import interact
```
## Motivation
Many tasks are repetitive:
- To print from 1 up to a user-specified number *arbitrarily large*.
- To compute the maximum of a sequence of numbers *arbitrarily long*.
- To get use... | github_jupyter |
# Use Spark to predict credit risk with `ibm-watson-machine-learning`
This notebook introduces commands for model persistance to Watson Machine Learning repository, model deployment, and scoring.
Some familiarity with Python is helpful. This notebook uses Python 3.6 and Apache® Spark 2.4.
You will use **German Credi... | github_jupyter |
```
import numpy as np
import pandas as pd
import os
import joblib
import sklearn
import matplotlib
from matplotlib import pyplot as plt
from sklearn.model_selection import train_test_split
#Regressions:
from sklearn.multioutput import MultiOutputRegressor
from sklearn.neighbors import KNeighborsRegressor
from sk... | github_jupyter |
```
# import esm
import torch
from argparse import Namespace
from esm.constants import proteinseq_toks
import math
import torch.nn as nn
import torch.nn.functional as F
from esm.modules import TransformerLayer, PositionalEmbedding # noqa
from esm.model import ProteinBertModel
# model, alphabet = torch.hub.load("faceb... | github_jupyter |
```
%pylab inline
import pandas as pd
import numpy as np
import pickle,itertools,sys,pdb
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import graphviz
from ultron.factor.genetic.accumulators import mutated_pool, cross_pool
from ultron.sentry.Analysis.SecurityValueHolders import SecurityValueHo... | github_jupyter |
<a href="https://colab.research.google.com/github/madhavjk/DataScience-ML_and_DL/blob/main/SESSION_20_(Decision_trees_and_Random_Forests).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 h... | github_jupyter |
<a href="https://colab.research.google.com/github/Shahid1993/colab-notebooks/blob/master/word_completion_prediction.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# [Making a Predictive Keyboard using Recurrent Neural Networks](https://medium.com/@... | github_jupyter |
# Extract barrier island metrics along transects
Author: Emily Sturdivant, esturdivant@usgs.gov
***
Extract barrier island metrics along transects for Barrier Island Geomorphology Bayesian Network. See the project [README](https://github.com/esturdivant-usgs/BI-geomorph-extraction/blob/master/README.md) and the Meth... | github_jupyter |
# MOwNiT – arytmetyka komputerowa

```
import numpy as np
import matplotlib.pyplot as plt
x1 = 4
n = 30
def visualize(points):
plt.figure(figsize=(12,6))
plt.axhline(y=3.14159, color='r', linestyle='--')
plt.xlabel("Xi")
plt.ylabel("points")
plt.plot(points, m... | github_jupyter |
```
import sys
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from astropy import constants as const
# remove this line if you installed platypos with pip
sys.path.append('/work2/lketzer/work/gitlab/platypos_group/platypos/')
import platypos
from platypos import Planet_LoFo14
from pla... | github_jupyter |
### Prepare the Dataset for Building a Predictive Model
As a first step we will build a graph convolution model predict ERK2 activity. We will train the model to distinguish a set of ERK2 active compounds from a set of decoy compounds. The active and decoy compounds are derived from the DUD-E database. In order to g... | github_jupyter |
```
import cv2
import numpy as np
from matplotlib import pyplot as plt
import os
import xlsxwriter
import pandas as pd # Excel
import struct # Binary writing
import scipy.io as sio # Read .mat files
import h5py
import time
from grading__old import *
from ipywidgets import FloatProgress
from IPython.display import d... | github_jupyter |
# Desafio 5
Neste desafio, vamos praticar sobre redução de dimensionalidade com PCA e seleção de variáveis com RFE. Utilizaremos o _data set_ [Fifa 2019](https://www.kaggle.com/karangadiya/fifa19), contendo originalmente 89 variáveis de mais de 18 mil jogadores do _game_ FIFA 2019.
> Obs.: Por favor, não modifique o ... | github_jupyter |
# Exercises
## Simple array manipulation
Investigate the behavior of the statements below by looking
at the values of the arrays a and b after assignments:
```
a = np.arange(5)
b = a
b[2] = -1
b = a[:]
b[1] = -1
b = a.copy()
b[0] = -1
```
Generate a 1D NumPy array containing numbers from -2 to 2
in increments of 0.2... | github_jupyter |
<a href="https://colab.research.google.com/github/everestso/Fall21Spring22/blob/main/c164s22ch3.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Tile Sliding Domain
```
import random
import heapq
random.seed(13)
StateDimension=3
# StateDimension=... | github_jupyter |
<a href="https://colab.research.google.com/github/Tessellate-Imaging/monk_v1/blob/master/study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3)%20Understand%20transfer%20learning%20and%20the%20role%20of%20number%20of%20dataset%20classes%20in%20it%20-%20Keras.ipynb" target="_parent"><img ... | github_jupyter |
```
# Automatically reload custom code modules when there are changes:
%load_ext autoreload
%autoreload 2
# Adjust relative path so that the notebook can find the code modules:
import sys
sys.path.append('../code/')
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
%matpl... | github_jupyter |
# **Neural Networks Summary**
```
from keras.models import Sequential
from keras.layers import Dense, Dropout, Conv2D, MaxPool2D, Flatten
from keras.utils import to_categorical
```
## Regression
```
model = Sequential()
n_cols = data.shape[1]
model.add(Dense(5, activation='relu', input_shape=(n_cols, ))) # input s... | github_jupyter |
```
import swat
import pandas as pd
import os
from sys import platform
import riskpy
from os.path import join as path
if "CASHOST" in os.environ:
# Create a session to the CASHOST and CASPORT variables set in your environment
conn = riskpy.SessionContext(session=swat.CAS(),
cas... | github_jupyter |
```
import pandas as pd
from openpyxl import Workbook
from openpyxl.styles import Border, Side, Font, Alignment
from openpyxl.utils.dataframe import dataframe_to_rows
```
# 測試資料
```
# 表格資料title
data = [
{"route_id": "0001", "route_desc": "路線1", "num_of_people": 100,
"origin_amt": 1000, "act_amt": 600, "subs... | github_jupyter |
# Semantic Function Species (part 2)
```
from scripts.imports import *
out = Exporter(
paths['outdir'],
'semantics'
)
from IPython.display import HTML, display
df.columns
```
# Miscellaneous Functions
```
df[df.funct_type == 'secondary'].function.value_counts()
funct2names = {
'purposive_ext':['purpext... | github_jupyter |
# COMP4096 Business Intelligence Group Project
## COVID-19 Data Analysis and Prediction
#### This part is written by Wong Tin Yau David (18207871).
##### Datasets below are downloaded from https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv, which is provided by https://ourworl... | github_jupyter |
TSG108 - View the controller upgrade config map
===============================================
Description
-----------
When running a Big Data Cluster upgrade using `azdata bdc upgrade`:
`azdata bdc upgrade --name <namespace> --tag <tag>`
It may fail with:
> Upgrading cluster to version 15.0.4003.10029\_2
>
> NOT... | github_jupyter |
```
import re
import numpy as np
import os
os.sys.path.append('../1/')
from z2 import loader
from math import log
import sys
import heapq
import collections
import operator
vowels = list('aeioóuyąę') + list('aeioóuyąę'.upper())
compacted_vovels = ['i' + x for x in vowels if x != 'i']
word2tag = dict()
tag2word = dict... | github_jupyter |
# 15天入门Python3
CopyRight by 黑板客
转载请联系heibanke_at_aliyun.com
**上节作业**
八皇后
```
%load day08/eight_queen.py
a = gen_n_queen(5)
printsolution(next(a))
```
## day09:谈对象—高富帅和白富美
1. <a href="#1">面向对象编程</a>
2. <a href="#2">**封装**, 属性和方法</a>
3. <a href="#3">**继承**</a>
4. <a href="#4">**多态** 与 重载</a>
5. <a href="#5">作业</a... | github_jupyter |
Starting with Chollet's advice -- program simple programs that can solve the first 10 tasks
```
import numpy as np
import json
from PIL import Image, ImageDraw
from IPython.display import Image as Im
import matplotlib.pyplot as plt
import collections
colorMap = {0:"black",1:"blue",2:"red", 3:"green",4:"yellow",5:"gre... | github_jupyter |
# Introdução ao Pandas - Viagens do Governo | Tratamento de dados
*Esse notebook usa o arquivo sobre [viagens de funcionários do governo](http://www.portaltransparencia.gov.br/viagens) disponibilizado no portal da transparência.*
```
import pandas as pd
df_viagem = pd.read_csv('viagens_2019.csv', encoding='latin-1', ... | github_jupyter |
```
import torch
import matplotlib.pyplot as plt
import tqdm
import utils
import dataloaders
import numpy as np
import torchvision
import os
from trainer import Trainer
torch.random.manual_seed(0)
np.random.seed(0)
torch.backends.cudnn.benchmark = False
torch.backends.cuda.deterministic = True
```
### Model Definition... | github_jupyter |
# HW7
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
%matplotlib inline
```
In order to ensure your plots are inline, make sure to run the matplotlib magic command.
# Q1
You are provided with a csv file (shoes.csv) on canvas that contains 2 columns.
The first ... | github_jupyter |
```
# These are all the modules we'll be using later. Make sure you can import them
# before proceeding further.
from __future__ import print_function
import os
import numpy as np
import random
import math
import string
import tensorflow as tf
import zipfile
from six.moves import range
from six.moves.urllib.request imp... | github_jupyter |
<a href="https://colab.research.google.com/github/b15145456/1st-ML-Marathon/blob/main/Day_010_HW.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# 作業 : (Kaggle)房價預測
# [作業目標]
- 試著模仿範例寫法, 在房價預測中, 觀察去除離群值的影響
# [作業重點]
- 觀察將極端值以上下限值取代, 對於分布與迴歸分數的影響 (In... | github_jupyter |
## February and April 2020 precipitation anomalies
In this notebook, we will analyze precipitation anomalies of February and April 2020, which seemed to be very contrasting in weather. We use the EOBS dataset.
### Import packages
```
##This is so variables get printed within jupyter
from IPython.core.interactiveshel... | github_jupyter |
# Collaboration Patterns By Year (International, Domestic, Internal)
Using the count capability of the API, Dimensions allows you to quickly identify international, domestic, and inernal Collaboration
This notebook shows how to quickly identify international, domestic, and internal collaboration using the [Organizati... | github_jupyter |
# LANL Earthquake Prediction
<a href="https://www.kaggle.com/c/LANL-Earthquake-Prediction/overview">Link to competition on Kaggle</a>
This notebook is a reimplementation of <a href="https://www.kaggle.com/tunguz/andrews-features-only">Andrews Feature Only</a>, with some modifications.
## Feature Engineering
The lar... | github_jupyter |
```
import warnings
warnings.filterwarnings("ignore")
import sys
import itertools
from keras.layers import Input, Dense, Reshape, Flatten
from keras import layers, initializers
from keras.models import Model, load_model
import keras.backend as K
import numpy as np
from seqtools import SequenceTools as ST
from gfp_gp i... | github_jupyter |
```
import numpy as np
class NelderMeadSimplexOptimizer:
reflection_coeff = 1.0
expansion_coeff = 2.0
contraction_coeff = 0.5
shrinking_coeff = 0.5
# <objective_function>: objective function, should match the specified dimension
# <dimension>: dimension of parameter vector (integer)
# <... | github_jupyter |
```
from google.colab import drive
drive.mount('/content/gdrive')
import tarfile
tfile = tarfile.open("/content/gdrive/My Drive/Deep Learning Groupwork/Project/Data.tar")
tfile.extractall()
training_dir = '/content/Data/Train'
val_dir = '/content/Data/Validation'
finetunedir = '/content/Data/FineTune'
testdir = '/conte... | github_jupyter |
<table class="ee-notebook-buttons" align="left">
<td><a target="_blank" href="https://github.com/giswqs/earthengine-py-notebooks/tree/master/Datasets/Terrain/srtm_landforms.ipynb"><img width=32px src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" /> View source on GitHub</a></td>
<td><a target="_blan... | github_jupyter |
```
from bokeh.io import output_notebook, show, reset_output
import numpy as np
output_notebook()
from IPython.display import IFrame
IFrame('https://demo.bokehplots.com/apps/sliders', width=900, height=500)
```
### Basic scatterplot
```
from bokeh.io import output_notebook, show
from bokeh.plotting import figure
# cr... | github_jupyter |
<a href="https://colab.research.google.com/github/jimfhahn/Machine-Learning-Tutorials/blob/master/C3_W3_Lab_1_Distributed_Training.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Ungraded lab: Distributed Strategies with TF and Keras
-------------... | github_jupyter |
```
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from astropy.time import Time
def convert_to_ap_Time(df, key):
print(key)
df[key] = pd.to_datetime(df[key])
df[key] = Time([t1.astype(str) for t1 in df[key].values], format="isot")
return df
def convert_ti... | github_jupyter |
```
#default_exp neighbors
#hide
from nbdev.showdoc import *
#hide
%load_ext autoreload
%autoreload 2
import sys
sys.path.append('..')
```
- weighted NN based on (possibly batch) grad descent of feature weights
- find optimizer engine
- find fast KNN for query time
- Define metric specific sampling function (based on... | github_jupyter |
```
%reload_ext autoreload
%autoreload 2
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.datasets import load_digits, load_iris
from sklearn.model_selection import train_test_split
from pca import pca as MyPCA
```
# Load Digit Dataset
```
digits... | github_jupyter |
```
import cv2
import numpy as np
img = cv2.imread("hough.jpg", 0)
print(type(img))
img = np.asarray(img)
#Fetching the rows and columns
rows = len(img)
cols = len(img[0])
```
# Sobel Operator
```
#initializing Sobel Operator
gx_sobel = [[-1,-2,-1],
[0,0,0],
[1,2,1]]
gy_sobel = [[-1,0,1],
... | github_jupyter |
**Important**: This notebook is different from the other as it directly calls **ImageJ Kappa plugin** using the [`scyjava` ImageJ brige](https://github.com/scijava/scyjava).
Since Kappa uses ImageJ1 features, you might not be able to run this notebook on an headless machine (need to be tested).
```
from pathlib impor... | github_jupyter |
# Classification 2
## Exercise 1: Exploratory Data Analysis
### Overview
The objective of this course is to build models to predict customer churn for a fictitious telco company. Before we start creating models, let's begin by having a closer look at our data and doing some basic data wrangling.
Go through this not... | github_jupyter |
```
import util
import jax
import jax.numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import numpy as base_np
from epiweeks import Week, Year
start = '2020-03-15'
forecast_start = '2020-04-19'
num_weeks = 8
data = util.load_state_data()
places = sorted(list(data.keys()))
#places = ['AK', 'AL']
allQ... | github_jupyter |
# Estimating the biomass of terrestrial arthropods
To estimate the biomass of terrestrial arthropods, we rely on two parallel methods - a method based on average biomass densities of arthropods extrapolated to the global ice-free land surface, and a method based on estimates of the average carbon content of a character... | github_jupyter |
# Pandas Exercise
```
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(0)
import pandas as pd
def df_info(df: pd.DataFrame) -> None:
return df.head(n=20).style
```
## Cars Auction Dataset
| Feature | Type | Description ... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.