code stringlengths 2.5k 150k | kind stringclasses 1
value |
|---|---|
# Word2Vec
**Learning Objectives**
1. Compile all steps into one function
2. Prepare training data for Word2Vec
3. Model and Training
4. Embedding lookup and analysis
## Introduction
Word2Vec is not a singular algorithm, rather, it is a family of model architectures and optimizations that can be used to learn wo... | github_jupyter |
# Numbers and Integer Math
Watch the full [C# 101 video](https://www.youtube.com/watch?v=jEE0pWTq54U&list=PLdo4fOcmZ0oVxKLQCHpiUWun7vlJJvUiN&index=5) for this module.
## Integer Math
You have a few `integers` defined below. An `integer` is a positive or negative whole number.
> Before you run the code, what should c... | github_jupyter |
## **Nigerian Music scraped from Spotify - an analysis**
Clustering is a type of [Unsupervised Learning](https://wikipedia.org/wiki/Unsupervised_learning) that presumes that a dataset is unlabelled or that its inputs are not matched with predefined outputs. It uses various algorithms to sort through unlabeled data a... | github_jupyter |
# ADMM Optimizer
## Introduction
The ADMM Optimizer can solve classes of mixed-binary constrained optimization problems, hereafter (MBCO), which often appear in logistic, finance, and operation research. In particular, the ADMM Optimizer here designed can tackle the following optimization problem $(P)$:
$$
\min_{x \... | github_jupyter |
# 4 Setting the initial SoC
Setting the initial SoC for your pack is performed with an argument passed to the solve algorithm. Currently the same value is applied to each battery but in future it will be possible to vary the SoC across the pack.
```
import liionpack as lp
import pybamm
import numpy as np
import matpl... | github_jupyter |
# Découverte du format CSV - *Comma-Separated values*
**Plan du document**
- Le format **CSV**
- Représenter des données CSV avec Python
- Première solution: un tableau de tuples
- **Deuxième solution**: un tableau de *tuples nommés* (dictionnaires)
- l'*unpacking*,
- l'opération *zip*
... | github_jupyter |
# TF neural net with normalized ISO spectra
```
# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras
# Helper libraries
import glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from concurrent.futures import ProcessPoolExecutor
from IPython.core.debugger import set_... | github_jupyter |
Filename: MNIST_data.ipynb
From <a href="http://neuralnetworksanddeeplearning.com/chap1.html"> this </a> book
Abbreviation: MNIST = Modified (handwritten digits data set from the U.S.) National Institute of Standards and Technology
Purpose: Explore the MNIST digits data to get familiar with the content and quality o... | github_jupyter |
# `asyncio` Beispiel
Ab IPython≥7.0 könnt ihr `asyncio` direkt in Jupyter Notebooks verwenden; seht auch [IPython 7.0, Async REPL](https://blog.jupyter.org/ipython-7-0-async-repl-a35ce050f7f7).
Wenn ihr die Fehlermeldung `RuntimeError: This event loop is already running` erhaltet, hilft euch vielleicht [nest-asyncio]... | github_jupyter |
# B - A Closer Look at Word Embeddings
We have very briefly covered how word embeddings (also known as word vectors) are used in the tutorials. In this appendix we'll have a closer look at these embeddings and find some (hopefully) interesting results.
Embeddings transform a one-hot encoded vector (a vector that is 0... | github_jupyter |
### This notebook explores the calendar of Munich listings to answer the question:
## What is the most expensive and the cheapest time to visit Munich?
```
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import seaborn as sns
sns.set()
LOCATION = 'munich'
df_list = pd.read_csv(LOCATION + ... | github_jupyter |
```
# second notebook for Yelp1 Labs 18 Project
# data cleanup
# imports
# dataframe
import pandas as pd
import json
# NLP
import gensim
from gensim.utils import simple_preprocess
from gensim.parsing.preprocessing import STOPWORDS
from gensim import corpora
# import review.json file from https://www.yelp.com/dataset
... | github_jupyter |
##### Copyright 2019 The TensorFlow Authors.
```
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | github_jupyter |
```
import pickle
from misc import *
import SYCLOP_env as syc
from RL_brain_b import DeepQNetwork
import cv2
import time
from mnist import MNIST
mnist = MNIST('/home/bnapp/datasets/mnist/')
images, labels = mnist.load_training()
# some_mnistSM =[ cv2.resize(1.+np.reshape(uu,[28,28]), dsize=(256, 256)) for uu in images... | github_jupyter |
```
import lifelines
import pymc as pm
from pyBMA.CoxPHFitter import CoxPHFitter
import matplotlib.pyplot as plt
import numpy as np
from numpy import log
from datetime import datetime
import pandas as pd
%matplotlib inline
```
The first step in any data analysis is acquiring and munging the data
Our starting data set... | github_jupyter |
# Probability Distributions
# Some typical stuff we'll likely use
```
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%config InlineBackend.figure_format = 'retina'
```
# [SciPy](https://scipy.org)
### [scipy.stats](https://docs.scipy.org/doc/scipy-0.14.0/reference/stats.html)
```
import s... | github_jupyter |
### Dr. Ignaz Semmelweis
```
import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import display
# Read datasets/yearly_deaths_by_clinic.csv into yearly
yearly = pd.read_csv('datasets/yearly_deaths_by_clinic.csv')
# Print out yearly
display(yearly)
```
### The alarming number of deaths
```
# Cal... | github_jupyter |
```
# Import the necessary libraries
import numpy as np
import pandas as pd
import os
import time
import warnings
import gc
gc.collect()
import os
from six.moves import urllib
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import datetime
warnings.filterwarnings('ignore')
%matplotlib inline
plt... | 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 |
<a id=top></a>
# Analysis of Engineered Features
## Table of Contents
**Note:** In this notebook, the engineered features are referred to as "covariates".
----
1. [Preparations](#prep)
2. [Analysis of Covariates](#covar_analysis)
1. [Boxplots](#covar_analysis_boxplots)
2. [Forward Mapping (onto Shape Space... | github_jupyter |
**Due Date: Monday, October 19th, 11:59pm**
- Fill out the missing parts.
- Answer the questions (if any) in a separate document or by adding a new `Text` block inside the Colab.
- Save the notebook by going to the menu and clicking `File` > `Download .ipynb`.
- Make sure the saved version is showing your solutions.
-... | github_jupyter |
```
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy
from fastai.script import *
from fastai.vision import *
from fastai.callbacks import *
from fastai.distributed import *
from fastprogress import fastprogress
from torchvision.models import *
from fastai.vision.models.xresnet import *
fr... | github_jupyter |
##Functions
Let's say that we have some code that does some task, but the code is 25 lines long, we need to run it over 1000 items and it doesn't work in a loop. How in the world will we handle this situation? That is where functions come in really handy. Functions are a generalized block of code that allow you to run ... | github_jupyter |
# Exploring colour channels
In this session, we'll be looking at how to explore the different colour channels that compris an image.
```
# We need to include the home directory in our path, so we can read in our own module.
import os
# image processing tools
import cv2
import numpy as np
# utility functions for thi... | github_jupyter |
# [모듈 2.1] SageMaker 클러스터에서 훈련 (No VPC에서 실행)
이 노트북은 아래의 작업을 실행 합니다.
- SageMaker Hosting Cluster 에서 훈련을 실행
- 훈련한 Job 이름을 저장
- 다음 노트북에서 모델 배포 및 추론시에 사용 합니다.
---
SageMaker의 세션을 얻고, role 정보를 가져옵니다.
- 위의 두 정보를 통해서 SageMaker Hosting Cluster에 연결합니다.
```
import os
import sagemaker
from sagemaker import get_execution_ro... | github_jupyter |
<a href="https://colab.research.google.com/github/iotanalytics/IoTTutorial/blob/main/code/preprocessing_and_decomposition/Matrix_Profile.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
## Matrix Profile
## Introduction
The matrix profile (MP) is a... | github_jupyter |
## Python Modules
```
%%writefile weather.py
def prognosis():
print("It will rain today")
import weather
weather.prognosis()
```
## How does Python know from where to import packages/modules from?
```
# Python imports work by searching the directories listed in sys.path.
import sys
sys.path
## "__main__" usage
... | github_jupyter |
```
# General imports
import numpy as np
import torch
# DeepMoD stuff
from multitaskpinn import DeepMoD
from multitaskpinn.model.func_approx import NN
from multitaskpinn.model.library import Library1D
from multitaskpinn.model.constraint import LeastSquares
from multitaskpinn.model.sparse_estimators import Threshold
fr... | github_jupyter |
```
%matplotlib inline
```
What is `torch.nn` *really*?
============================
by Jeremy Howard, `fast.ai <https://www.fast.ai>`_. Thanks to Rachel Thomas and Francisco Ingham.
We recommend running this tutorial as a notebook, not a script. To download the notebook (.ipynb) file,
click `here <https://pytorch.o... | github_jupyter |
```
import pandas as pd
#Google colab does not have pickle
try:
import pickle5 as pickle
except:
!pip install pickle5
import pickle5 as pickle
import os
import seaborn as sns
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.preprocessing.text import Tokenizer
from keras... | github_jupyter |
```
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split # for spliting the data into train and test
from sklearn.tree import DecisionTreeClassifier # For creating a decision a tree
from sklear... | github_jupyter |
# Homework
```
import matplotlib.pyplot as plt
%matplotlib inline
import random
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from plotting import overfittingDemo, plot_multiple_linear_regression, overlay_simple_linear_model,plot_simple_residuals
from scipy.optimize import... | github_jupyter |
# CS231n_CNN for Visual Recognition
> Stanford University CS231n
- toc: true
- badges: true
- comments: true
- categories: [CNN]
- image: images/
---
- http://cs231n.stanford.edu/
---
# Image Classification
- **Image Classification:** We are given a **Training Set** of labeled images, asked to predict labels on *... | github_jupyter |
##### Copyright 2020 Google LLC.
Licensed under the Apache License, Version 2.0 (the "License");
```
#@title License header
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | github_jupyter |
# ART for TensorFlow v2 - Keras API
This notebook demonstrate applying ART with the new TensorFlow v2 using the Keras API. The code follows and extends the examples on www.tensorflow.org.
```
import warnings
warnings.filterwarnings('ignore')
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
import numpy ... | github_jupyter |
# Prophet
Time serie forecasting using Prophet
Official documentation: https://facebook.github.io/prophet/docs/quick_start.html
Procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It is released by Fac... | github_jupyter |
```
from PyEIS import *
```
## Frequency range
The first first step needed to simulate an electrochemical impedance spectra is to generate a frequency domain, to do so, use to build-in freq_gen() function, as follows
```
f_range = freq_gen(f_start=10**10, f_stop=0.1, pts_decade=7)
# print(f_range[0]) #First 5 points ... | github_jupyter |
```
#hide
#default_exp examples.complex_dummy_experiment_manager
from nbdev.showdoc import *
from block_types.utils.nbdev_utils import nbdev_setup, TestRunner
nbdev_setup ()
tst = TestRunner (targets=['dummy'])
```
# Complex Dummy Experiment Manager
> Dummy experiment manager with features that allow additional func... | github_jupyter |
# Workshop 13
## _Object-oriented programming._
#### Classes and Objects
```
class MyClass:
pass
obj1 = MyClass()
obj2 = MyClass()
print(obj1)
print(type(obj1))
print(obj2)
print(type(obj2))
```
##### Constructor and destructor
```
class Employee:
def __init__(self):
print('Employee create... | github_jupyter |
# Scalable GP Classification in 1D (w/ KISS-GP)
This example shows how to use grid interpolation based variational classification with an `ApproximateGP` using a `GridInterpolationVariationalStrategy` module. This classification module is designed for when the inputs of the function you're modeling are one-dimensional... | github_jupyter |
```
import numpy as np
import astropy
from itertools import izip
from pearce.mocks import compute_prim_haloprop_bins, cat_dict
from pearce.mocks.customHODModels import *
from halotools.utils.table_utils import compute_conditional_percentiles
from halotools.mock_observables import hod_from_mock, wp, tpcf, tpcf_one_two_h... | github_jupyter |
# Showing uncertainty
> Uncertainty occurs everywhere in data science, but it's frequently left out of visualizations where it should be included. Here, we review what a confidence interval is and how to visualize them for both single estimates and continuous functions. Additionally, we discuss the bootstrap resampling... | github_jupyter |
<a href="https://colab.research.google.com/github/mariokart345/DS-Unit-2-Applied-Modeling/blob/master/module3-permutation-boosting/LS_DS_233.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
Lambda School Data Science
*Unit 2, Sprint 3, Module 3*
--... | github_jupyter |
<h1><center>Introductory Data Analysis Workflow</center></h1>

https://xkcd.com/2054
# An example machine learning notebook
* Original Notebook by [Randal S. Olson](http://www.randalolson.com/)
* Supported by [Jason H. Moore](http://www.epistasis.org/)
* ... | github_jupyter |
## Example 2: Sensitivity analysis on a NetLogo model with SALib
This notebook provides a more advanced example of interaction between NetLogo and a Python environment, using the SALib library (Herman & Usher, 2017; available through the pip package manager) to sample and analyze a suitable experimental design for a S... | github_jupyter |
```
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
players_time = pd.read_csv("players_time.csv")
events_time = pd.read_csv("events_time.csv")
serve_time = pd.read_csv("serve_times.csv")
players_time
events_time
pd.options.display.max_rows = None
events_time
serve_time
```
## 1. Visualize Th... | github_jupyter |
```
%matplotlib inline
%reload_ext autoreload
%autoreload 2
from fastai.conv_learner import *
from fastai.dataset import *
from fastai.models.resnet import vgg_resnet50
import json
#torch.cuda.set_device(2)
torch.backends.cudnn.benchmark=True
```
## Data
```
PATH = Path('/home/giles/Downloads/fastai_data/salt/')
MAS... | github_jupyter |
```
# feature extractoring and preprocessing data
# 음원 데이터를 분석
import librosa
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# notebook을 실행한 브라우저에서 바로 그림을 볼 수 있게 해주는 것
%matplotlib inline
# 운영체제와의 상호작용을 돕는 다양한 기능을 제공
# 1. 현재 디렉토리 확인하기
# 2. 디렉토리 변경
# 3. 현재 디렉토리의 파일 목록 확인하기
# 4. csv 파일 호출
import... | github_jupyter |
# AWS Elastic Kubernetes Service (EKS) Deep MNIST
In this example we will deploy a tensorflow MNIST model in Amazon Web Services' Elastic Kubernetes Service (EKS).
This tutorial will break down in the following sections:
1) Train a tensorflow model to predict mnist locally
2) Containerise the tensorflow model with o... | github_jupyter |
# **Introduction to TinyAutoML**
---
TinyAutoML is a Machine Learning Python3.9 library thought as an extension of Scikit-Learn. It builds an adaptable and auto-tuned pipeline to handle binary classification tasks.
In a few words, your data goes through 2 main preprocessing steps. The first one is scaling and NonSta... | github_jupyter |
# Computer Vision Nanodegree
## Project: Image Captioning
---
In this notebook, you will train your CNN-RNN model.
You are welcome and encouraged to try out many different architectures and hyperparameters when searching for a good model.
This does have the potential to make the project quite messy! Before subm... | github_jupyter |
# Mount google drive to colab
```
from google.colab import drive
drive.mount("/content/drive")
```
# Import libraries
```
import os
import random
import numpy as np
import shutil
import time
from PIL import Image, ImageOps
import cv2
import pandas as pd
import math
import matplotlib.pyplot as plt
import seaborn a... | github_jupyter |
```
import numpy as np
import scipy.sparse as sp
from sklearn.datasets import load_svmlight_file
from oracle import Oracle, make_oracle
import scipy as sc
from methods import OptimizeLassoProximal, OptimizeGD, NesterovLineSearch
import matplotlib.pyplot as plt
from sklearn import linear_model
```
Решаем задачу логисти... | github_jupyter |
## Implementing BERT with SNGP
```
!pip install tensorflow_text==2.7.3
!pip install -U tf-models-official==2.7.0
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import sklearn.metrics
import sklearn.calibration
import tensorflow_hub as hub
import tensorflow_datasets as tfds
import numpy as np
imp... | github_jupyter |
<a href="https://colab.research.google.com/github/jeffheaton/t81_558_deep_learning/blob/master/t81_558_class_02_4_pandas_functional.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# T81-558: Applications of Deep Neural Networks
**Module 2: Python fo... | github_jupyter |
# Charting a path into the data science field
This project attempts to shed light on the path or paths to becoming a data science professional in the United States.
Data science is a rapidly growing field, and the demand for data scientists is outpacing supply. In the past, most Data Scientist positions went to peopl... | github_jupyter |
# 基本程序设计
- 一切代码输入,请使用英文输入法
```
print('hello word')
print 'hello'
```
## 编写一个简单的程序
- 圆公式面积: area = radius \* radius \* 3.1415
```
radius = 1.0
area = radius * radius * 3.14 # 将后半部分的结果赋值给变量area
# 变量一定要有初始值!!!
# radius: 变量.area: 变量!
# int 类型
print(area)
```
### 在Python里面不需要定义数据的类型
## 控制台的读取与输入
- input 输入进去的是字符串
- eva... | github_jupyter |
```
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from torch.jit import script, trace
import torch.nn as nn
from torch import optim
import torch.nn.functional as F
import csv
import random
import re
impo... | github_jupyter |
# 0.0. IMPORTS
```
import math
import pandas as pd
import inflection
import numpy as np
import seaborn as sns
import matplotlib as plt
import datetime
from IPython.display import Image
```
## 0.1. Helper Functions
## 0.2. Loading Data
```
# read_csv é um metodo da classe Pandas
# Preciso "unzipar" o arquivo antes?... | github_jupyter |
## Dependencies
```
import os
import cv2
import shutil
import random
import warnings
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from tensorflow import set_random_seed
from sklearn.utils import class_weight
from sklearn.model_selection import train_test_split
from sklea... | github_jupyter |
<!--TITLE:Custom Convnets-->
# Introduction #
Now that you've seen the layers a convnet uses to extract features, it's time to put them together and build a network of your own!
# Simple to Refined #
In the last three lessons, we saw how convolutional networks perform **feature extraction** through three operations:... | github_jupyter |
# Looking up Trig Ratios
There are three ways you could find the value of a trig function at a particular angle.
**1. Use a table** - This is how engineers used to find trig ratios before the days of computers. For example, from the table below I can see that $\sin(60)=0.866$
| angle | sin | cos | tan |
| :---: | :--... | github_jupyter |
```
from gs_quant.data import Dataset
from gs_quant.markets.securities import Asset, AssetIdentifier, SecurityMaster
from gs_quant.timeseries import *
from gs_quant.target.instrument import FXOption, IRSwaption
from gs_quant.markets import PricingContext, HistoricalPricingContext, BackToTheFuturePricingContext
from gs_... | github_jupyter |
# 💡 Solutions
Before trying out these solutions, please start the [gqlalchemy-workshop notebook](../workshop/gqlalchemy-workshop.ipynb) to import all data. Also, this solutions manual is here to help you out, and it is recommended you try solving the exercises first by yourself.
## Exercise 1
**Find out how many ge... | github_jupyter |
```
# "PGA Tour Wins Classification"
```
Can We Predict If a PGA Tour Player Won a Tournament in a Given Year?
Golf is picking up popularity, so I thought it would be interesting to focus my project here. I set out to find what sets apart the best golfers from the rest.
I decided to explore their statistics and to s... | github_jupyter |
# Monte Carlo Methods
In this notebook, you will write your own implementations of many Monte Carlo (MC) algorithms.
While we have provided some starter code, you are welcome to erase these hints and write your code from scratch.
### Part 0: Explore BlackjackEnv
We begin by importing the necessary packages.
```
i... | github_jupyter |
```
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
#%matplotlib inline
from IPython.core.pylabtools import figsize
figsize(8, 6)
sns.set()
```
## Carregando dados dos usuários premium
```
df = pd.read_csv("../data/processed/premium_students.csv",parse_dates=[1,2],index_c... | github_jupyter |
# Minimum spanning trees
*Selected Topics in Mathematical Optimization*
**Michiel Stock** ([email](michiel.stock@ugent.be))

```
import matplotlib.pyplot as plt
%matplotlib inline
from minimumspanningtrees import red, green, blue, orange, yellow
```
## Graphs in python
Consider the following ... | github_jupyter |
<a href="https://colab.research.google.com/github/yukinaga/bert_nlp/blob/main/section_2/03_simple_bert.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a>
# シンプルなBERTの実装
訓練済みのモデルを使用し、文章の一部の予測、及び2つの文章が連続しているかどうかの判定を行います。
## ライブラリのインストール
PyTorch-Transfor... | github_jupyter |
# Binary Search or Bust
> Binary search is useful for searching, but its implementation often leaves us searching for edge cases
- toc: true
- badges: true
- comments: true
- categories: [data structures & algorithms, coding interviews, searching]
- image: images/binary_search_gif.gif
# Why should you care?
Binary s... | github_jupyter |
**INITIALIZATION:**
- I use these three lines of code on top of my each notebooks because it will help to prevent any problems while reloading the same project. And the third line of code helps to make visualization within the notebook.
```
#@ INITIALIZATION:
%reload_ext autoreload
%autoreload 2
%matplotlib inline
``... | github_jupyter |
```
# Import packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Read in data. If data is zipped, unzip the file and change file path accordingly
yelp = pd.read_csv("../yelp_academic_dataset_business.csv",
dtype={'attributes': str, 'postal_code': str}, low_memory=False)
... | github_jupyter |
# 내가 닮은 연예인은?
사진 모으기
얼굴 영역 자르기
얼굴 영역 Embedding 추출
연예인들의 얼굴과 거리 비교하기
시각화
회고
1. 사진 모으기
2. 얼굴 영역 자르기
이미지에서 얼굴 영역을 자름
image.fromarray를 이용하여 PIL image로 변환한 후, 추후에 시각화에 사용
```
# 필요한 모듈 불러오기
import os
import re
import glob
import glob
import pickle
import pandas as pd
import matplotlib.pyplot as plt
import matplotl... | github_jupyter |
#### loading the libraries
```
import os
import sys
import pyvista as pv
import trimesh as tm
import numpy as np
import topogenesis as tg
import pickle as pk
sys.path.append(os.path.realpath('..\..')) # no idea how or why this is not working without adding this to the path TODO: learn about path etc.
from notebooks.re... | github_jupyter |
<h1>Notebook Content</h1>
1. [Import Packages](#1)
1. [Helper Functions](#2)
1. [Input](#3)
1. [Model](#4)
1. [Prediction](#5)
1. [Complete Figure](#6)
<h1 id="1">1. Import Packages</h1>
Importing all necessary and useful packages in single cell.
```
import numpy as np
import keras
import tensorflow as tf
from numpy... | github_jupyter |
# **Libraries**
```
from google.colab import drive
drive.mount('/content/drive')
# ***********************
# *****| LIBRARIES |*****
# ***********************
%tensorflow_version 2.x
import pandas as pd
import numpy as np
import os
import json
from sklearn.model_selection import train_test_split
import tensorflow as ... | github_jupyter |
```
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
from statsmodels.formula.api import ols
import researchpy as rp
from pingouin import kruskal
from pybedtools import BedTool
RootChomatin_bp_covered = '../../data/promoter_analysis/responsivepromoters... | github_jupyter |
```
dataset = 'load' # 'load' or 'generate'
retrain_models = False # False or True or 'save'
import numpy as np
import pandas as pd
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.FATAL)
import gpflow
import library.models.deep_vmgp as deep_vmgp
import library.models.vmgp as vmgp
from doubly_stochastic_dgp... | github_jupyter |
# Notebook para o PAN - Atribuição Autoral - 2018
```
%matplotlib inline
#python basic libs
import os;
from os.path import join as pathjoin;
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from sklearn.exceptions import UndefinedMetricWarning
warnings.simplefilter(action='ignore', categ... | github_jupyter |
# 电影评论文本分类
此笔记本(notebook)使用评论文本将影评分为*积极(positive)*或*消极(nagetive)*两类。这是一个*二元(binary)*或者二分类问题,一种重要且应用广泛的机器学习问题。
我们将使用来源于[网络电影数据库(Internet Movie Database)](https://www.imdb.com/)的 [IMDB 数据集(IMDB dataset)](https://tensorflow.google.cn/api_docs/python/tf/keras/datasets/imdb),其包含 50,000 条影评文本。从该数据集切割出的25,000条评论用作训练,另外 25,... | github_jupyter |
# Just Plot It!
## Introduction
### The System
In this course we will work with a set of "experimental" data to illustrate going from "raw" measurement (or simulation) data through exploratory visualization to an (almost) paper ready figure.
In this scenario, we have fabricated (or simulated) 25 cantilevers. There... | github_jupyter |
## 8. Classification
[Data Science Playlist on YouTube](https://www.youtube.com/watch?v=VLKEj9EN2ew&list=PLLBUgWXdTBDg1Qgmwt4jKtVn9BWh5-zgy)
[](https://www.youtube.com/watch?v=VLKEj9EN2ew&list=PLLBUgWXdTBDg1Qgmwt4jKtVn9BWh5-zgy ... | github_jupyter |
## Installing & importing necsessary libs
```
!pip install -q transformers
import numpy as np
import pandas as pd
from sklearn import metrics
import transformers
import torch
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler
from transformers import AlbertTokenizer, AlbertModel, Albert... | github_jupyter |
# Droplet Evaporation
```
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
# Ethyl Acetate
#time_in_sec = np.array([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110])
#diameter = np.array([2.79,2.697,2.573,2.542,2.573,2.48,2.449,2.449,2.387,2.356,2.263,2.232,2.201,2.13... | github_jupyter |
# Enable GPU
```
import torch
device = torch.device('cuda:0' if torch.cuda.is_available else 'cpu')
```
# Actor and Critic Network
```
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Actor_Net(nn.Module):
def __init__(self, input_dims, output_dims, num_neuro... | github_jupyter |
## Import Necessary Packages
```
import numpy as np
import pandas as pd
import datetime
import os
np.random.seed(1337) # for reproducibility
from sklearn.model_selection import train_test_split
from sklearn.metrics.classification import accuracy_score
from sklearn.preprocessing import MinMaxScaler
from sklearn.metri... | github_jupyter |
# 3D Map
While representing the configuration space in 3 dimensions isn't entirely practical it's fun (and useful) to visualize things in 3D.
In this exercise you'll finish the implementation of `create_grid` such that a 3D grid is returned where cells containing a voxel are set to `True`. We'll then plot the result!... | github_jupyter |
# Prologue
For this project we will use the logistic regression function to model the growth of confirmed Covid-19 case population growth in Bangladesh. The logistic regression function is commonly used in classification problems, and in this project we will be examining how it fares as a regression tool. Both cumulat... | github_jupyter |
# FloPy
## Plotting SWR Process Results
This notebook demonstrates the use of the `SwrObs` and `SwrStage`, `SwrBudget`, `SwrFlow`, and `SwrExchange`, `SwrStructure`, classes to read binary SWR Process observation, stage, budget, reach to reach flows, reach-aquifer exchange, and structure files. It demonstrates these... | github_jupyter |
[제가 미리 만들어놓은 이 링크](https://colab.research.google.com/github/heartcored98/Standalone-DeepLearning/blob/master/Lec4/Lab6_result_report.ipynb)를 통해 Colab에서 바로 작업하실 수 있습니다!
런타임 유형은 python3, GPU 가속 확인하기!
```
!mkdir results
import torch
import torchvision
import torchvision.transforms as transforms
import torch.nn as nn
im... | github_jupyter |
```
import pandas as pd
import numpy as np
df_properti = pd.read_csv("https://raw.githubusercontent.com/ardhiraka/PFDS_sources/master/property_data.csv")
df_properti
df_properti.shape
df_properti.columns
df_properti["ST_NAME"]
df_properti["ST_NUM"].isna()
list_missing_values = ["n/a", "--", "na"]
df_properti = pd.read_... | github_jupyter |
## 1、可视化DataGeneratorHomographyNet模块都干了什么
```
import glob
import os
import cv2
import numpy as np
from dataGenerator import DataGeneratorHomographyNet
img_dir = os.path.join(os.path.expanduser("~"), "/home/nvidia/test2017")
img_ext = ".jpg"
img_paths = glob.glob(os.path.join(img_dir, '*' + img_ext))
dg = DataGenerator... | github_jupyter |
# Diamond Prices: Model Tuning and Improving Performance
#### Importing libraries
```
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
pd.options.mode.chained_assignment = None
%matplotlib inline
```
#### Loading the dataset
```
DATA_DIR = '../data'
FILE_NAME =... | github_jupyter |
# Visualizing COVID-19 Hospital Dataset with Seaborn
**Pre-Work:**
1. Ensure that Jupyter Notebook, Python 3, and seaborn (which will also install dependency libraries if not already installed) are installed. (See resources below for installation instructions.)
### **Instructions:**
1. Using Python, import main visua... | github_jupyter |
# Temporal-Difference Methods
In this notebook, you will write your own implementations of many Temporal-Difference (TD) methods.
While we have provided some starter code, you are welcome to erase these hints and write your code from scratch.
---
### Part 0: Explore CliffWalkingEnv
We begin by importing the necess... | github_jupyter |
```
import re
import pandas as pd
import os
import html
os.chdir('/Users/lindsayduca/Desktop/Downloads')
#file="US20220000001A1-20220106.XML"
#file="USD0864516-20191029.XML"
file = open(file="ipa220106.txt", mode='r') #opening the file in read mode
file_content_raw = file.read()
file.close()
text1=re.compile("<\?x... | github_jupyter |
# Loads pre-trained model and get prediction on validation samples
### 1. Info
Please provide path to the relevant config file
```
config_file_path = "../configs/pretrained/config_model1.json"
```
### 2. Importing required modules
```
import os
import cv2
import sys
import importlib
import torch
import torchvision
... | github_jupyter |
# Bar charts
This is 'abusing' the scatter object to create a 3d bar chart
```
import ipyvolume as ipv
import numpy as np
# set up data similar to animation notebook
u_scale = 10
Nx, Ny = 30, 15
u = np.linspace(-u_scale, u_scale, Nx)
v = np.linspace(-u_scale, u_scale, Ny)
x, y = np.meshgrid(u, v, indexing='ij')
r = n... | github_jupyter |
# ReinforcementLearning: a)UCB, b)ThompsonSampling
**--------------------------------------------------------------------------------------------------------------------------**
**--------------------------------------------------------------------------------------------------------------------------**
**------------... | github_jupyter |
# Emukit tutorials
Emukit tutorials can be added and used through the links below. The goal of each of these tutorials is to explain a particular functionality of the Emukit project. These tutorials are stand-alone notebooks that don't require any extra files and fully sit on Emukit components (apart from the creation... | github_jupyter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.