text stringlengths 2.5k 6.39M | kind stringclasses 3
values |
|---|---|
```
#写函数,求n个随机整数均值的平方根,整数范围在m与k之间
import random,math
def pingfanggeng():
m = int(input('请输入一个大于0的整数,作为随机整数的下界,回车结束。'))
k = int(input('请输入一个大于0的整数,作为随机整数的上界,回车结束。'))
n = int(input('请输入随机整数的个数,回车结束。'))
i=0
total=0
while i<n:
total=total+random.randint(m,k)
i=i+1
average=total/... | github_jupyter |
# `pandas` Part 2: this notebook is a 2nd lesson on `pandas`
## The main objective of this tutorial is to slice up some DataFrames using `pandas`
>- Reading data into DataFrames is step 1
>- But most of the time we will want to select specific pieces of data from our datasets
# Learning Objectives
## By the end of th... | github_jupyter |
# Exp 101 analysis
See `./informercial/Makefile` for experimental
details.
```
import os
import numpy as np
from IPython.display import Image
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import seaborn as sns
sns.set_style('ticks')
matplotlib.... | github_jupyter |
# Creating a Linear Cellular Automaton
Let's start by creating a linear cellular automaton

import numpy as np
import tensorflow as tf
import os
os.environ["CUDA_VISIBLE_DEVICES"]="1"
np.random.seed(123)
tf.compat.v1.set_rando... | github_jupyter |
# The Discrete-Time Fourier Transform
*This Jupyter notebook is part of a [collection of notebooks](../index.ipynb) in the bachelors module Signals and Systems, Comunications Engineering, Universität Rostock. Please direct questions and suggestions to [Sascha.Spors@uni-rostock.de](mailto:Sascha.Spors@uni-rostock.de).*... | github_jupyter |
# KakaoBrunch12M
KakaoBrunch12M은 [카카오 아레나에서 공개한 데이터](https://arena.kakao.com/datasets?id=2)로 [브런치 서비스](https://brunch.co.kr) 사용자를 통해 수집한 데이터입니다.
이 예제에서는 브런치 데이터에서 ALS를 활용해 특정 글과 유사한 글을 추천하는 예제와 개인화 추천 예제 두 가지를 살펴보겠습니다.
```
import buffalo.data
from buffalo.algo.als import ALS
from buffalo.algo.options import ALSOption... | github_jupyter |
# Análisis de la Movilidad en Bogotá
¿Cuáles son las rutas más críticas de movilidad y sus características en la ciudad de Bogotá?
Se toman los datos de la plataforma:
https://datos.movilidadbogota.gov.co
```
import pandas as pd
import os
os.chdir('../data_raw')
data_file_list = !ls
data_file_list
data_file_list[len... | github_jupyter |
**Chapter 11 – Training Deep Neural Networks**
_This notebook contains all the sample code and solutions to the exercises in chapter 11._
<table align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/ageron/handson-ml2/blob/master/11_training_deep_neural_networks.ipynb"><img src="h... | github_jupyter |
```
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set_style("whitegrid", {'axes.grid' : False})
import joblib
import catboost
import xgboost as xgb
import lightgbm as lgb
from category_encoders import BinaryEncoder
from sklearn.metric... | github_jupyter |
# Session 7: The Errata Review No. 1
This session is a review of the prior six sessions and covering those pieces that were left off. Not necessarily errors, but missing pieces to complete the picture from the series. These topics answer some questions and will help complete the picture of the C# language features d... | github_jupyter |
<a href="https://colab.research.google.com/github/jonkrohn/ML-foundations/blob/master/notebooks/2-linear-algebra-ii.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Linear Algebra II: Matrix Operations
This topic, *Linear Algebra II: Matrix Operat... | github_jupyter |

## Classification
Classification - predicting the discrete class ($y$) of an object from a vector of input features ($\vec x$).
Models used in this notebook include: Logistic Regression, Support Vector Machines, KNN
**Author List**: Kevin Li
**Original Sources**: http://sci... | github_jupyter |
# Inference
## Imports & Args
```
import argparse
import json
import logging
import os
import random
from io import open
import numpy as np
import math
import _pickle as cPickle
from scipy.stats import spearmanr
from tensorboardX import SummaryWriter
from tqdm import tqdm
from bisect import bisect
import yaml
from e... | github_jupyter |
# Day 9 - Finding the sum, again, with a running series
* https://adventofcode.com/2020/day/9
This looks to be a variant of the [day 1, part 1 puzzle](./Day%2001.ipynb); finding the sum of two numbers in a set. Only now, we have to make sure we know what number to remove as we progres! This calls for a _sliding windo... | github_jupyter |
# Campus SEIR Modeling
## Campus infection data
The following data consists of new infections reported since August 3, 2020, from diagnostic testing administered by the Wellness Center and University Health Services at the University of Notre Dame. The data is publically available on the [Notre Dame Covid-19 Dashboar... | github_jupyter |
```
# dependencies
import pandas as pd
from sqlalchemy import create_engine, inspect
# read raw data csv
csv_file = "NYC_Dog_Licensing_Dataset.csv"
all_dog_data = pd.read_csv(csv_file)
all_dog_data.head(10)
# trim data frame to necessary columns
dog_data_df = all_dog_data[['AnimalName','AnimalGender','BreedName','Bo... | github_jupyter |
# What's this PyTorch business?
You've written a lot of code in this assignment to provide a whole host of neural network functionality. Dropout, Batch Norm, and 2D convolutions are some of the workhorses of deep learning in computer vision. You've also worked hard to make your code efficient and vectorized.
For the ... | github_jupyter |
# test note
* jupyterはコンテナ起動すること
* テストベッド一式起動済みであること
```
!pip install --upgrade pip
!pip install --force-reinstall ../lib/ait_sdk-0.1.7-py3-none-any.whl
from pathlib import Path
import pprint
from ait_sdk.test.hepler import Helper
import json
# settings cell
# mounted dir
root_dir = Path('/workdir/root/ait')
ait_n... | github_jupyter |
# HM2: Numerical Optimization for Logistic Regression.
### Name: [Your-Name?]
## 0. You will do the following:
1. Read the lecture note: [click here](https://github.com/wangshusen/DeepLearning/blob/master/LectureNotes/Logistic/paper/logistic.pdf)
2. Read, complete, and run my code.
3. **Implement mini-batch SGD** ... | github_jupyter |
```
%matplotlib inline
import math
import numpy
import pandas
import seaborn
import matplotlib.pyplot as plt
import plot
def fmt_money(number):
return "${:,.0f}".format(number)
def run_pmt(market, pmt_rate):
portfolio = 1_000_000
age = 65
max_age = 100
df = pandas.DataFrame(index=range(age, max_age... | github_jupyter |
```
import os
import json
import boto3
import sagemaker
import numpy as np
from source.config import Config
config = Config(filename="config/config.yaml")
sage_session = sagemaker.session.Session()
s3_bucket = config.S3_BUCKET
s3_output_path = 's3://{}/'.format(s3_bucket)
print("S3 bucket path: {}".format(s3_output_p... | github_jupyter |
<!--BOOK_INFORMATION-->
<img align="left" style="padding-right:10px;" src="figures/PDSH-cover-small.png">
*This notebook contains an excerpt from the [Python Data Science Handbook](http://shop.oreilly.com/product/0636920034919.do) by Jake VanderPlas; the content is available [on GitHub](https://github.com/jakevdp/Pytho... | github_jupyter |
# TV Script Generation
In this project, you'll generate your own [Seinfeld](https://en.wikipedia.org/wiki/Seinfeld) TV scripts using RNNs. You'll be using part of the [Seinfeld dataset](https://www.kaggle.com/thec03u5/seinfeld-chronicles#scripts.csv) of scripts from 9 seasons. The Neural Network you'll build will ge... | github_jupyter |
```
import pandas as pd
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasRegressor
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import StandardScaler
from sklearn... | github_jupyter |
```
# - Decide which map to plot
# in main notebook code
#mapvarnow = 'skj' # choose: skj, bet
# - Define constant plot params
stipsizenow = 10; stipmarknow = 'o'
stipfacecolnow = 'none'
stipedgeltcolnow = 'whitesmoke'
stipewnow = 0.8 # marker edge width
eezfcnow = 'none'; eezlcnow = 'lightgray' #'silver'
eezlsnow = '... | github_jupyter |

# Ejemplo de simulación numérica
```
import numpy as np
from scipy.integrate import odeint
from matplotlib import rc
import matplotlib.pyplot as plt
%matplotlib inline
rc("text", usetex=True)
rc("font", size=18)
rc("figure", figsize=(6,4))
rc("axes", grid=True)
```
## Problema físico

# Chapter 8: Basic Data Wrangling With Pandas
<h2>Chapter Outline<span class="tocSkip"></span></h2>
<hr>
<div class="toc"><ul class="toc-item"><li><span><a href="#1.-DataFrame-Characteristics" data-toc-modified-id="1.-DataFrame-Characteristics-2">1. DataFrame Characteristics</a></span></li><li... | github_jupyter |
```
#hide
from qbism import *
```
# Tutorial
> "Chauncey Wright, a nearly forgotten philosopher of real merit, taught me when young that I must not say necessary about the universe, that we don’t know whether anything is necessary or not. So I describe myself as a bettabilitarian. I believe that we can bet on the beh... | github_jupyter |
# 5장
```
import matplotlib
matplotlib.rc('font', family="NanumBarunGothicOTF")
%matplotlib inline
```
# 5.2 아이리스 데이터셋
```
import pandas as pd
from matplotlib import pyplot as plt
import sklearn.datasets
def get_iris_df():
ds = sklearn.datasets.load_iris()
df = pd.DataFrame(ds['data'], columns=ds['feature... | github_jupyter |
In this notebook you can define your own configuration and run the model based on your custom configuration.
## Dataset
`dataset_name` is the name of the dataset which will be used in the model. In case of using KITTI, `dataset_path` shows the path to `data_paths` directory that contains every image and its pair path... | github_jupyter |
# <font color=green> PYTHON PARA DATA SCIENCE - PANDAS
---
# <font color=green> 1. INTRODUÇÃO AO PYTHON
---
# 1.1 Introdução
> Python é uma linguagem de programação de alto nível com suporte a múltiplos paradigmas de programação. É um projeto *open source* e desde seu surgimento, em 1991, vem se tornando uma das lin... | github_jupyter |
<a href="https://colab.research.google.com/github/google/applied-machine-learning-intensive/blob/master/content/03_regression/04_polynomial_regression/colab.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
#### Copyright 2020 Google LLC.
```
# Licen... | github_jupyter |
# Portfolio Variance
```
import sys
!{sys.executable} -m pip install -r requirements.txt
import numpy as np
import pandas as pd
import time
import os
import quiz_helper
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('ggplot')
plt.rcParams['figure.figsize'] = (14, 8)
```
### data bundle
```
import o... | github_jupyter |
# Exploring Weather Trends
### by Phone Thiri Yadana
In this project, we will analyze Gobal vs Singapore weather data across 10 Years Moving Average.
[<img src="./new24397338.png"/>](https://www.vectorstock.com/royalty-free-vector/kawaii-world-and-thermometer-cartoon-vector-24397338)
-------------
```
import pandas... | github_jupyter |
[0: NumPy and the ndarray](gridded_data_tutorial_0.ipynb) | **1: Introduction to xarray** | [2: Daymet data access](gridded_data_tutorial_2.ipynb) | [3: Investigating SWE at Mt. Rainier with Daymet](gridded_data_tutorial_3.ipynb)
# Notebook 1: Introduction to xarray
Waterhackweek 2020 | Steven Pestana (spestana@uw.edu... | github_jupyter |
# Big Query Connector - Quick Start
The BigQuery connector enables you to read/write data within BigQuery with ease and integrate it with YData's platform.
Reading a dataset from BigQuery directly into a YData's `Dataset` allows its usage for Data Quality, Data Synthetisation and Preprocessing blocks.
## Storage and ... | github_jupyter |
# Developing a Pretrained Alexnet model using ManufacturingNet
###### To know more about the manufacturingnet please visit: http://manufacturingnet.io/
```
import ManufacturingNet
import numpy as np
```
First we import manufacturingnet. Using manufacturingnet we can create deep learning models with greater ease.
I... | github_jupyter |
```
# reload packages
%load_ext autoreload
%autoreload 2
```
### Choose GPU (this may not be needed on your computer)
```
%env CUDA_DEVICE_ORDER=PCI_BUS_ID
%env CUDA_VISIBLE_DEVICES=''
```
### load packages
```
from tfumap.umap import tfUMAP
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt... | github_jupyter |
# Power Production Project for *Fundamentals of Data Analysis* at GMIT
by Radek Wojtczak G00352936<br>
**Instructions:**
>In this project you must perform and explain simple linear regression using Python
on the powerproduction dataset. The goal is to accurately predict wind turbine power output from wind speed va... | github_jupyter |
```
import random
import torch.nn as nn
import torch
import pickle
import pandas as pd
from pandas import Series, DataFrame
from pandarallel import pandarallel
pandarallel.initialize(progress_bar=False)
from sklearn.metrics import roc_auc_score, roc_curve, accuracy_score, matthews_corrcoef, f1_score, precision_score, r... | github_jupyter |
# Tigergraph<>Graphistry Fraud Demo: Raw REST
Accesses Tigergraph's fraud demo directly via manual REST calls
```
#!pip install graphistry
import pandas as pd
import graphistry
import requests
#graphistry.register(key='MY_API_KEY', server='labs.graphistry.com', api=2)
TIGER = "http://MY_TIGER_SERVER:9000"
#curl -X... | github_jupyter |
# Project 1
- **Team Members**: Chika Ozodiegwu, Kelsey Wyatt, Libardo Lambrano, Kurt Pessa

### Data set used:
* https://open-fdoh.hub.arcgis.com/datasets/florida-covid19-case-line-data
```
import requests
import pandas as pd
import io
import datetime as dt
import numpy as np
imp... | github_jupyter |
# Benchmark NumPyro in large dataset
This notebook uses `numpyro` and replicates experiments in references [1] which evaluates the performance of NUTS on various frameworks. The benchmark is run with CUDA 10.1 on a NVIDIA RTX 2070.
```
import time
import numpy as np
import jax.numpy as jnp
from jax import random
i... | github_jupyter |
```
import pandas as pd
df = pd.read_csv(r'C:\Users\rohit\Documents\Flight Delay\flightdata.csv')
df.head()
df.shape
df.isnull().values.any()
df.isnull().sum()
df = df.drop('Unnamed: 25', axis=1)
df.isnull().sum()
df = pd.read_csv(r'C:\Users\rohit\Documents\Flight Delay\flightdata.csv')
df = df[["MONTH", "DAY_OF_MONTH... | github_jupyter |
# Python Dictionaries
## Dictionaries
* Collection of Key - Value pairs
* also known as associative array
* unordered
* keys unique in one dictionary
* storing, extracting
```
emptyd = {}
len(emptyd)
type(emptyd)
tel = {'jack': 4098, 'sape': 4139}
print(tel)
tel['guido'] = 4127
print(tel.keys())
print(tel.values())
... | github_jupyter |
# Chapter 1 - Softmax from First Principles
## Language barriers between humans and autonomous systems
If our goal is to help humans and autnomous systems communicate, we need to speak in a common language. Just as humans have verbal and written languages to communicate ideas, so have we developed mathematical langua... | github_jupyter |
---
_You are currently looking at **version 1.1** of this notebook. To download notebooks and datafiles, as well as get help on Jupyter notebooks in the Coursera platform, visit the [Jupyter Notebook FAQ](https://www.coursera.org/learn/python-text-mining/resources/d9pwm) course resource._
---
# Assignment 1
In this... | github_jupyter |
# Imports
```
import torch
from torch.autograd import Variable
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.insert(0, "lib/")
from utils.preprocess_sample import preprocess_sample
from utils.collate_custom import collate_custom
from utils.utils import... | github_jupyter |
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc" style="margin-top: 1em;"><ul class="toc-item"><li><span><a href="#Queries" data-toc-modified-id="Queries-1"><span class="toc-item-num">1 </span>Queries</a></span><ul class="toc-item"><li><span><a href="#All-Videos" data-toc-modified-id=... | github_jupyter |
# Check Cell Count
## Libraries
```
import pandas
import MySQLdb
import numpy as np
import pickle
import os
```
## Functions and definitions
```
# - - - - - - - - - - - - - - - - - - - -
# Define Experiment
table = 'IsabelCLOUPAC_Per_Image'
# - - - - - - - - - - - - - - - - - - - -
def ensure_dir(file_path):
... | github_jupyter |
```
# Binary Tree Basic Implimentations
# For harder questions and answers, refer to:
# https://github.com/volkansonmez/Algorithms-and-Data-Structures-1/blob/master/Binary_Tree_All_Methods.ipynb
import numpy as np
np.random.seed(0)
class BST():
def __init__(self, root = None):
self.root = root
... | github_jupyter |
```
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '0' # specify GPUs locally
package_paths = [
'./input/pytorch-image-models/pytorch-image-models-master', #'../input/efficientnet-pytorch-07/efficientnet_pytorch-0.7.0'
'./input/pytorch-gradual-warmup-lr-master'
]
import sys;
for pth in package_paths:
sys.... | github_jupyter |
<a href="https://colab.research.google.com/github/temiafeye/Colab-Projects/blob/master/Fraud_Detection_Algorithm(Using_SOMs).ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
```
!pip install numpy
#Build Hybrid Deep Learning Model
import numpy as np... | github_jupyter |
```
# THIS SCRIPT IS TO GENERATE AGGREGATIONS OF EXPLANATIONS for interesting FINDINGS
%load_ext autoreload
%autoreload 2
import os
import json
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
import torch.nn.functional as F
import torchvision
from torchvision import models
from torchvision imp... | github_jupyter |
# Ejercicios de agua subterránea
```
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
%matplotlib inline
plt.style.use('dark_background')
#plt.style.use('seaborn-whitegrid')
```
## <font color=steelblue>Ejercicio 1 - Infiltración. Método de Green-Ampt
<font color=steelblue>Usando el mode... | 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 |
```
#from nbdev import *
%load_ext autoreload
%autoreload 2
#%nbdev_hide
#import sys
#sys.path.append("..")
```
# Examples
> Examples of the PCT library in use.
```
import gym
render=False
runs=1
#gui
render=True
runs=2000
```
## Cartpole
Cartpole is an Open AI gym environment for the inverted pendulum problem. T... | github_jupyter |
# Getting Started with NumPy
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Getting-Started-with-NumPy" data-toc-modified-id="Getting-Started-with-NumPy-1"><span class="toc-item-num">1 </span>Getting Started with NumPy</a></span><ul class="t... | github_jupyter |
RMedian : Phase 3 / Clean Up Phase
```
import math
import random
import statistics
```
Testfälle :
```
# User input
testcase = 3
# Automatic
X = [i for i in range(101)]
cnt = [0 for _ in range(101)]
# ------------------------------------------------------------
# Testcase 1 : Det - max(sumL, sumR) > n/2
# Unlaban... | github_jupyter |
# CS229: Problem Set 1
## Problem 3: Gaussian Discriminant Analysis
**C. Combier**
This iPython Notebook provides solutions to Stanford's CS229 (Machine Learning, Fall 2017) graduate course problem set 1, taught by Andrew Ng.
The problem set can be found here: [./ps1.pdf](ps1.pdf)
I chose to write the solutions to... | github_jupyter |
# Variable Distribution Type Tests (Gaussian)
- Shapiro-Wilk Test
- D’Agostino’s K^2 Test
- Anderson-Darling Test
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(font_scale=2, palette= "viridis")
from scipy import stats
data = pd.read_csv('../data/pulse_data.... | github_jupyter |
# Collaboration and Competition
---
In this notebook, you will learn how to use the Unity ML-Agents environment for the third project of the [Deep Reinforcement Learning Nanodegree](https://www.udacity.com/course/deep-reinforcement-learning-nanodegree--nd893) program.
### 1. Start the Environment
We begin by import... | github_jupyter |
# K-Nearest Neighbours
Let’s build a K-Nearest Neighbours model from scratch.
First, we will define some generic `KNN` object. In the constructor, we pass three parameters:
- The number of neighbours being used to make predictions
- The distance measure we want to use
- Whether or not we want to use weighted distanc... | github_jupyter |
```
import pandas as pd
import numpy as np
import json
from cold_start import get_cold_start_rating
import pyspark
spark = pyspark.sql.SparkSession.builder.getOrCreate()
sc = spark.sparkContext
ratings_df = spark.read.json('data/ratings.json').toPandas()
metadata = pd.read_csv('data/movies_metadata.csv')
request_df = s... | github_jupyter |
```
import os
import sys
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torchsummary import summary
sys.path.append('../')
sys.path.append('../src/')
from src import utils
from src import generators
import imp
os.environ['CUD... | github_jupyter |
Corrigir versao de scipy para Inception
```
pip install scipy==1.3.3
```
Importar bibliotecas
```
from __future__ import division, print_function
from torchvision import datasets, models, transforms
import copy
import matplotlib.pyplot as plt
import numpy as np
import os
import shutil
import time
import torch
import... | github_jupyter |
<a href="https://colab.research.google.com/github/flych3r/IA025_2022S1/blob/main/ex04/matheus_xavier/IA025_A04.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# Regressão Softmax com dados do MNIST utilizando gradiente descendente estocástico por mi... | github_jupyter |
# Science User Case - Inspecting a Candidate List
Ogle et al. (2016) mined the NASA/IPAC Extragalactic Database (NED) to identify a new type of galaxy: Superluminous Spiral Galaxies. Here's the paper:
Here's the paper: https://ui.adsabs.harvard.edu//#abs/2016ApJ...817..109O/abstract
Table 1 lists the positions of th... | github_jupyter |

<font size=3 color="midnightblue" face="arial">
<h1 align="center">Escuela de Ciencias Básicas, Tecnología e Ingeniería</h1>
</font>
<font size=3 color="navy" face="arial">
<h1 align="center">ECBTI</h1>
</font>
<font size=2 color="darkor... | github_jupyter |
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
# Deploying a web service to Azure Kubernetes Service (AKS)
This notebook shows the steps for deploying a service: registering a model, creating an image, provisioning a cluster (one time action), and deploying a service to it. ... | github_jupyter |
##### Copyright 2020 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 |
# Analyzing Street Trees: Diversity Indices and the 10/20/30 Rule
This notebook analyzes the diversity indices of the street trees inside and outside the city center you've selected, and then check the tree inventory according to the 10/20/30 rule, discussed below.
```
# library import
import pandas as pd
import geop... | github_jupyter |
# Linear Regression
---
- Author: Diego Inácio
- GitHub: [github.com/diegoinacio](https://github.com/diegoinacio)
- Notebook: [regression_linear.ipynb](https://github.com/diegoinacio/machine-learning-notebooks/blob/master/Machine-Learning-Fundamentals/regression_linear.ipynb)
---
Overview and implementation of *Linear ... | github_jupyter |
```
import sys
sys.path.append('../src')
import csv
import yaml
import tqdm
import math
import pickle
import numpy as np
import pandas as pd
import itertools
import operator
from operator import concat, itemgetter
from pickle_wrapper import unpickle, pickle_it
import matplotlib.pyplot as plt
import dask
from dask.distr... | github_jupyter |
# Clusters as Knowledge Areas of Annotators
```
# import required packages
import sys
sys.path.append("../..")
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from annotlib import ClusterBasedAnnot
from sklearn.datasets import make_classi... | github_jupyter |
**This notebook is an exercise in the [Introduction to Machine Learning](https://www.kaggle.com/learn/intro-to-machine-learning) course. You can reference the tutorial at [this link](https://www.kaggle.com/dansbecker/your-first-machine-learning-model).**
---
## Recap
So far, you have loaded your data and reviewed it... | github_jupyter |
# Meet in the Middle Attack
- Given prime `p`
- then `Zp* = {1, 2, 3, ..., p-1}`
- let `g` and `h` be elements in `Zp*` such that
- such that `h mod p = g^x mod p` where ` 0 < x < 2^40`
- find `x` given `h`, `g`, and `p`
# Idea
- let `B = 2^20` then `B^2 = 2^40`
- then `x= xo * B + x1` where `xo` and `x1` are in `{0,... | github_jupyter |
# Vega, Ibis, and OmniSci Performance
In this notebook we will show two charts. The first generally works, albeit is a bit slow. The second is basically inoperable because of performance issues.
I believe these performance issues are primarily due to two limitations in Vega currently:
1. Each transform in the datafl... | github_jupyter |
# Cross-Validation
Cross-validation is a step where we take our training sample and further divide it in many folds, as in the illustration here:
```{image} ./img/feature_5_fold_cv.jpg
:alt: 5-fold
:width: 400px
:align: center
```
As we talked about in the last chapter, cross-validation allows us to test our models ... | github_jupyter |
# Project Euler in R
## Number letter counts
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
**NOTE:** Do n... | github_jupyter |
# Module 5: Research Dissemination (30 minutes)
From "[Piled Higher and Deeper](http://phdcomics.com/comics/archive.php?comicid=1174)" by Jorge Cham
<img src="http://www.phdcomics.com/comics/archive/phd051809s.gif" />
## Take a moment to read these University policies
### Openness in Research
In Section 2.2 of the [... | github_jupyter |
## Introduction
This notebook demostrates the core functionality of pymatgen, including the core objects representing Elements, Species, Lattices, and Structures.
By convention, we import pymatgen as mg.
```
import pymatgen as mg
```
## Basic Element, Specie and Composition objects
Pymatgen contains a set of core... | github_jupyter |
# Stock Price Prediction From Employee / Job Market Information
## Modelling: Linear Model
Objective utilise the Thinknum LinkedIn and Job Postings datasets, along with the Quandl WIKI prices dataset to investigate the effect of hiring practices on stock price. In this notebook I'll begin exploring the increase in pred... | github_jupyter |
```
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:75% !important; }</style>"))
import numpy as np
import torch
import time
from carle.env import CARLE
from carle.mcl import CornerBonus, SpeedDetector, PufferDetector, AE2D, RND2D
from game_of_carle.agents.harli import HARLI
fro... | github_jupyter |
# Network Visualization (TensorFlow)
In this notebook we will explore the use of *image gradients* for generating new images.
When training a model, we define a loss function which measures our current unhappiness with the model's performance; we then use backpropagation to compute the gradient of the loss with respe... | github_jupyter |
# LassoRegresion with Scale & Power Transformer
This Code template is for the regression analysis using Lasso Regression, the feature transformation technique Power Transformer and rescaling technique Scale in a pipeline. Lasso stands for Least Absolute Shrinkage and Selection Operator is a type of linear regression t... | github_jupyter |
```
#http://colah.github.io/posts/2015-08-Understanding-LSTMs/
from collections import Counter
import json
import nltk
from nltk.corpus import stopwords
WORD_FREQUENCY_FILE_FULL_PATH = "analysis.vocab"
class MyVocabulary:
def __init__(self, vocabulary, wordFrequencyFilePath):
self.vocabulary = vocabul... | 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 |
# Le Bloc Note pour ajouter du style
Dans un notebook jupyter on peut rédiger des commentaires en langage naturel, intégrer des liens hypertextes, des images et des vidéos en langage HTML dans des cellules de type **`Markdown`**.
C'est ce que décrit le bloc-note [HTML](HTML-Le_BN_pour_multimedier.ipynb) - Un bloc-not... | github_jupyter |
```
%cd ../..
%run cryptolytic/notebooks/init.ipynb
import pandas as pd
import cryptolytic.util.core as util
import cryptolytic.start as start
import cryptolytic.viz.plot as plot
import cryptolytic.data.sql as sql
import cryptolytic.data.historical as h
import cryptolytic.model as m
from statsmodels.graphics.tsaplots ... | github_jupyter |
# 0. Setup
```
# Imports
import arviz as az
import io
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymc3 as pm
import scipy
import scipy.stats as st
import theano.tensor as tt
# Helper functions
def plot_golf_data(data, ax=None):
"""Utility function to standardize a pretty plotti... | github_jupyter |
# RoadMap 16 - Classification 3 - Training & Validating [Custom CNN, Custom Dataset]
```
import torch
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
import matplotlib.pyplot as plt
import numpy as np
from torchvision import datasets
```
# [NOTE: - The network, transformatio... | github_jupyter |
```
%reload_ext autoreload
%autoreload 2
import warnings
warnings.filterwarnings('ignore')
import os.path as op
from collections import Counter
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# from tabulate import tabulate
from rdkit.Chem import AllChem as Chem
from rdki... | github_jupyter |
## Some fundamental elements of programming III
### Understanding and creating correlated datasets and how to create functions
As we said before, the core of data science is computer programming.
To really explore data, we need to be able to write code to
(1) wrangle or even generate data that has the properties... | github_jupyter |
## Prep notebook
```
import bz2
import json
import os
import random
import re
import string
import mwparserfromhell
import numpy as np
import pandas as pd
import requests
import findspark
findspark.init('/usr/lib/spark2')
from pyspark.sql import SparkSession
!which python
spark = (
SparkSession.builder
.app... | github_jupyter |
### Demonstration of Quantum Key Distribution with the Ekert 91 Protocol
Algorithm -
1. First generate the a maximally entangled qubit pair |psi+> = 1/root(2) * (|01> + |10>)
2. Send one qubit to Alice and one qubit to Bob
3. Both Alice and Bob perform their measurement and make the measurement bases public.
4. Accord... | github_jupyter |
# Modules
Python has a way to put definitions in a file so they can easily be reused.
Such files are called a modules. You can define your own module (for instance see [here](https://docs.python.org/3/tutorial/modules.html)) how to do this but in this course we will only discuss how to use
existing modules as they co... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.