code
stringlengths
2.5k
150k
kind
stringclasses
1 value
``` import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import operator df_Confirmed=pd.read_csv('/content/drive/My Drive/datasets/Tensorflow community challenge /Datasets /time_series_2019-ncov-Confirmed (1).csv') df_Confirmed.head() draft=df_Confirmed.copy() df_Confirmed.keys...
github_jupyter
# Introduction A mass on a spring experiences a force described by Hookes law. For a displacment $x$, the force is $$F=-kx,$$ where $k$ is the spring constant with units of N/m. The equation of motion is $$ F = ma $$ or $$ -k x = m a .$$ Because acceleration is the second derivative of displacment, this is a differ...
github_jupyter
# Module 5 Lab - Data ``` % matplotlib inline ``` The special command above will make all the `matplotlib` images appear in the notebook. ## Directions **Failure to follow the directions will result in a "0"** The due dates for each are indicated in the Syllabus and the course calendar. If anything is unclear, ple...
github_jupyter
A **Deep Q Network** implementation in tensorflow with target network & random experience replay. The code is tested with Gym's discrete action space environment, CartPole-v0 on Colab. --- ## Notations: Model network = $Q_{\theta}$ Model parameter = $\theta$ Model network Q value = $Q_{\theta}$ (s, a) Target netw...
github_jupyter
# Using PS GPIO with PYNQ ## Goal The aim of this notebook is to show how to use the Zynq PS GPIO from PYNQ. The PS GPIO are simple wires from the PS, and don't need a controller in the programmable logic. Up to 96 input, output and tri-state PS GPIO are available via the EMIO in the Zynq Ultrascale+. They can be u...
github_jupyter
### Basics of Tensorflow ``` import numpy as np from tensorflow.python.layers import base import tensorflow as tf import tensorflow.contrib.slim as slim # To support both python 2 and python 3 from __future__ import division, print_function, unicode_literals # Common imports import numpy as np import os # to make...
github_jupyter
# Example 1d: Spin-Bath model, fitting of spectrum and correlation functions ### Introduction The HEOM method solves the dynamics and steady state of a system and its environment, the latter of which is encoded in a set of auxiliary density matrices. In this example we show the evolution of a single two-level system...
github_jupyter
``` import random g = 10 # number of genes m = 10 # max length of a gene, a gene is a collection of integers "v" v = 100 # max value for "v" genome = [[random.randint(0,v) for _ in range(random.randint(0,m))] for _ in range(g)] genome def mutate(genome, t='deletion', p=0.1): if t == 'SNP': new_genome...
github_jupyter
``` import pyspark.sql import pyspark.sql.functions as sf spark = pyspark.sql.SparkSession.Builder().getOrCreate() ``` # Watson Sales Product Sample Data In this example, we want to have a look at the pivoting capabilities of Spark. Since pivoting is commonly used with sales data containing information for different ...
github_jupyter
``` # export from local.imports import * from local.notebook.core import * from local.notebook.export import * import nbformat,inspect from nbformat.sign import NotebookNotary from nbconvert.preprocessors import ExecutePreprocessor from local.test import * from local.core import * # default_exp notebook.test ``` # Ext...
github_jupyter
``` from scripts.constants import SimulationConstants from scripts.epidemic_metrics import dead_ratio, infected_ratio %load_ext autoreload %autoreload 2 from scripts.simulation import init_run_simulation import scripts.visualization as viz viz.load_matplotlib() plt = viz.plt contants = SimulationConstants() metrics =...
github_jupyter
# Developing an AI application Going forward, AI algorithms will be incorporated into more and more everyday applications. For example, you might want to include an image classifier in a smart phone app. To do this, you'd use a deep learning model trained on hundreds of thousands of images as part of the overall appli...
github_jupyter
<a href="https://colab.research.google.com/github/Tessellate-Imaging/Monk_Object_Detection/blob/master/example_notebooks/4_efficientdet/train%20-%20with%20validation%20dataset.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Installation - Run th...
github_jupyter
# Generating conditional probability tables subject to constraints ``` import os from pathlib import Path from itertools import product import numpy as np import pandas as pd from fake_data_for_learning.fake_data_for_learning import ( BayesianNodeRV, FakeDataBayesianNetwork, SampleValue ) from fake_data_for_lea...
github_jupyter
``` # python David_2_2_2_train_detector.py --class "../../../CV_PyImageSearch/Dataset/Chapter_Specific/chp2_2_stop_sign/stop_sign_images --annotations ../../../CV_PyImageSearch/Dataset/Chapter_Specific/chp2_2_stop_sign/stop_sign_annotations --output ../../../CV_PyImageSearch/Dataset/Chapter_Specific/chp2_2_stop_sign/ou...
github_jupyter
# Spatiotemporal distribution of AxFUCCI cells ``` # Required libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt %matplotlib inline import scipy import os import seaborn as sns from pyabc import (Distribution, History) # Experimental data outgrowth_df = pd.read_csv('./outgrowth.csv') out...
github_jupyter
``` import scanpy as sc import pandas as pd import xarray as xr from numpy import ones from pandas_plink import read_plink1_bin from numpy.linalg import cholesky import matplotlib.pyplot as plt import time from limix.qc import quantile_gaussianize import cellregmap cellregmap from cellregmap import estimate_betas mydir...
github_jupyter
# Set up Azure ML Automated Machine Learning on SQL Server 2019 CTP 2.4 big data cluster \# Prerequisites: \# - An Azure subscription and resource group \# - An Azure Machine Learning workspace \# - A SQL Server 2019 CTP 2.4 big data cluster with Internet access and a database named 'automl' \# - Azure C...
github_jupyter
``` import itertools from fractions import Fraction from typing import Tuple, Sequence from pprint import pprint import numpy as np import scipy.stats as st import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import theano as th import theano.tensor as T import pymc3 as pm from hypothesis impor...
github_jupyter
(parallel)= # Parallelization ``` %config InlineBackend.figure_format = "retina" from matplotlib import rcParams rcParams["savefig.dpi"] = 100 rcParams["figure.dpi"] = 100 rcParams["font.size"] = 20 import multiprocessing multiprocessing.set_start_method("fork") ``` :::{note} Some builds of NumPy (including the ...
github_jupyter
``` #Note: You need to reset the kernel for the keras installation to take place #Todo: Remove this line once it is installed, reset the kernel: Menu > Kernel > Reset & Clear Output !git clone https://github.com/fchollet/keras.git && cd keras && python setup.py install --user import keras from keras.applications.incept...
github_jupyter
# MAT281 - Laboratorio Nยฐ01 <a id='p1'></a> ## Problema 01 ### a) Calcular el nรบmero $\pi$ En los siglos XVII y XVIII, James Gregory y Gottfried Leibniz descubrieron una serie infinita que sirve para calcular $\pi$: $$\displaystyle \pi = 4 \sum_{k=1}^{\infty}\dfrac{(-1)^{k+1}}{2k-1} = 4(1-\dfrac{1}{3}+\dfrac{1}{5}...
github_jupyter
# Depression Detection in Social Media Posts #### Imports ``` import warnings warnings.filterwarnings("ignore") import ftfy import matplotlib.pyplot as plt import nltk import numpy as np import pandas as pd import re from math import exp from numpy import sign from sklearn.metrics import classification_report, con...
github_jupyter
# Index Day/Night - Run in python This only needs to be done once ``` import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits import mplot3d import numpy as np import cmocean import warnings from matplotlib import rcParams from mpl_toolkits.axes_grid1 import make_axes_locatable warnings.filterwarnings('i...
github_jupyter
# Feldman and Cousins intervals with asymptotics. This is a copy of `FC_interval_freq.ipynb` using the asymptotic formulae instead of toys. ``` import numpy as np import matplotlib.pyplot as plt import os import time import zfit from zfit.loss import UnbinnedNLL from zfit.minimize import Minuit zfit.settings.set_see...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import pandas as pd import xarray as xr import cartopy.crs as ccrs import glob import os import scipy.stats from matplotlib import cm import seaborn as sns import dask import pickle from datetime import datetime import ast from dask.distributed import Client, Local...
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
``` %load_ext watermark %watermark -p torch,pytorch_lightning,torchvision,torchmetrics,matplotlib %load_ext pycodestyle_magic %flake8_on --ignore W291,W293,E703 ``` <a href="https://pytorch.org"><img src="https://raw.githubusercontent.com/pytorch/pytorch/master/docs/source/_static/img/pytorch-logo-dark.svg" width="90"...
github_jupyter
# Investigate HPS profile ``` %matplotlib inline import sys sys.path.append('/home/surchs/Repositories/abide_univariate/') import asdfc import pandas as pd import scipy as sp import numpy as np import patsy as pat import nibabel as nib import pathlib as pal import seaborn as sbn import matplotlib as mpl from matplotli...
github_jupyter
## Drawing Edgeworth Box ``` import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D %matplotlib inline def Edgeworth_box(u1, u2, util1, util2, MRS1, MRS2, ttl, ttl_margin= 1, top=0.7, fname=None): l1 = 0.00000001 x1 = np.arange(l1, u1, 0.01) x2 = np.arange(l1, u2, 0.01)...
github_jupyter
``` import os import networkx as nx import pandas as pd import numpy as np import pickle as pkl import itertools from sklearn.manifold import TSNE import stellargraph as sg from stellargraph import StellarGraph from stellargraph import globalvar from stellargraph.mapper import GraphSAGENodeGenerator from stellargraph...
github_jupyter
## Test monthly means with leap year for GNSS-RO data ``` import xarray as xr import matplotlib.pyplot as plt import numpy as np from netCDF4 import num2date import func as func ds_obs = xr.open_dataset('GPS-RO__CP_LR_5x5_2007-2018.nc') ds_era5 = xr.open_dataset('FULL-ERA5.monthmean.2007-2018.concat_new.nc') ds_erai =...
github_jupyter
# Transforming Vertical Coordinates A common need in the analysis of ocean and atmospheric data is to transform the vertical coordinate from its original coordinate (e.g. depth) to a new coordinate (e.g. density). Xgcm supports this sort of one-dimensional coordinate transform on `Axis` and `Grid` objects using the `t...
github_jupyter
# Transpose of a Matrix In this set of exercises, you will work with the transpose of a matrix. Your first task is to write a function that takes the transpose of a matrix. Think about how to use nested for loops efficiently. The second task will be to write a new matrix multiplication function that takes advantage ...
github_jupyter
# 1์žฅ ํ•œ๋ˆˆ์— ๋ณด๋Š” ๋จธ์‹ ๋Ÿฌ๋‹ #### ๊ฐ์‚ฌ์˜ ๊ธ€ ์ž๋ฃŒ๋ฅผ ๊ณต๊ฐœํ•œ ์ €์ž ์˜ค๋ ๋ฆฌ์•™ ์ œ๋กฑ๊ณผ ๊ฐ•์˜์ž๋ฃŒ๋ฅผ ์ง€์›ํ•œ ํ•œ๋น›์•„์นด๋ฐ๋ฏธ์—๊ฒŒ ์ง„์‹ฌ์–ด๋ฆฐ ๊ฐ์‚ฌ๋ฅผ ์ „ํ•ฉ๋‹ˆ๋‹ค. ## 1.1 ๋จธ์‹ ๋Ÿฌ๋‹์ด๋ž€? - ์•„์„œ ์ƒˆ๋ฎค์–ผ(Artuhr Samuel), 1959 > ๋จธ์‹ ๋Ÿฌ๋‹์€ **๋ช…์‹œ์ ์ธ ํ”„๋กœ๊ทธ๋ž˜๋ฐ** ์—†์ด ์ปดํ“จํ„ฐ๊ฐ€ ํ•™์Šตํ•˜๋Š” ๋Šฅ๋ ฅ์„ ๊ฐ–์ถ”๊ฒŒ ํ•˜๋Š” ์—ฐ๊ตฌ ๋ถ„์•ผ - ํ†ฐ ๋ฏธ์ฒผ(Tom Michell), 1977 > ์–ด๋–ค ์ž‘์—… T์— ๋Œ€ํ•œ ์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ์˜ ์„ฑ๋Šฅ์„ P๋กœ ์ธก์ •ํ–ˆ์„ ๋•Œ > ๊ฒฝํ—˜ E๋กœ ์ธํ•ด ์„ฑ๋Šฅ์ด ํ–ฅ์ƒ๋˜์—ˆ๋‹ค๋ฉด, > ์ด ์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ์€ __์ž‘์—… T์™€ ์„ฑ๋Šฅ ์ธก์ • P์— ๋Œ€ํ•ด ๊ฒฝํ—˜ E๋กœ๋ถ€ํ„ฐ ํ•™์Šตํ•œ...
github_jupyter
``` #Setup and imports import pandas as pd import numpy as np df = pd.read_csv('raw/jantojun2020.csv', dtype=object) existing = pd.read_csv('raw/airlines-corgis.csv') #For looking at our new dataset df.head(5).iloc[:,0:] #For looking at the old dataset existing.head(5) existing.iloc[0:10, 5:] #Start similar dataframe f...
github_jupyter
#### ฮ ฮกฮŸฮฃฮŸฮงฮ—: ฮคฮฑ joblib dumps ฯ„ฯ‰ฮฝ ฯ„ฮตฮปฮนฮบฯŽฮฝ `corpus_tf_idf.pkl` ฮบฮฑฮน `som.pkl` ฮดฮตฮฝ ฯ€ฮตฯฮนฮญฯ‡ฮฟฮฝฯ„ฮฑฮน ฯƒฯ„ฮฟ zip file ฮบฮฑฮธฯŽฯ‚ ฮตฮฏฯ‡ฮฑฮฝ ฮฑฯ€ฮฑฮณฮฟฯฮตฯ…ฯ„ฮนฮบฮฌ ฮผฮตฮณฮฌฮปฮฟ ฮผฮญฮณฮตฮธฮฟฯ‚. ฮ‘ฯ…ฯ„ฯŒ ฮ”ฮ•ฮ ฮฟฯ†ฮตฮฏฮปฮตฯ„ฮฑฮน ฯƒฮต ฮดฮนฮบฮฎ ฮผฮฑฯ‚ ฮตฮปฮปฮนฯ€ฮฎ ฯ…ฮปฮฟฯ€ฮฟฮฏฮทฯƒฮท, ฮฑฮปฮปฮฌ ฯƒฮต ฮผฮนฮฑ ฮนฮดฮนฮฟฮผฮฟฯฯ†ฮฏฮฑ ฯ„ฮฟฯ… corpus ฯ€ฮฟฯ… ฮผฮฑฯ‚ ฮฑฮฝฯ„ฮนฯƒฯ„ฮฟฮนฯ‡ฮตฮฏ ฮบฮฑฮน ฮฑฮฝฮฑฮณฮบฮฌฮถฮตฮน ฮฟฯฮนฯƒฮผฮญฮฝฮฟฯ…ฯ‚ ฯ€ฮฏฮฝฮฑฮบฮตฯ‚ ฮฝฮฑ ฮฑฮฝฯ„ฮนฯƒฯ„ฮฟฮนฯ‡ฮฏฮถฮฟฮฝฯ„ฮฑฮน ฮฑฯ‡ฯฮตฮฏฮฑฯƒฯ„ฮฑ ฯƒฮต float...
github_jupyter
### Abstract This is an example to show to use use the basic API of TensorFlow, to construct a linear regression model. This notebook is an exercise adapted from [the Medium.com blog](https://medium.com/@saxenarohan97/intro-to-tensorflow-solving-a-simple-regression-problem-e87b42fd4845). Note that recent version of...
github_jupyter
# High Accuracy CNN for MNIST ### Build your own CNN from scratch and try to achieve the highest possible accuracy on MNIST. ``` # Exercise: Build your own CNN from scratch and try to achieve the highest possible accuracy on MNIST. # he following model uses 2 convolutional layers, followed by 1 pooling layer, then dr...
github_jupyter
# [Module 2.1] ์„ธ์ด์ง€ ๋ฉ”์ด์ปค ๋กœ์ปฌ ๋ชจ๋“œ ๋ฐ ์Šคํฌ๋ฆฝํŠธ ๋ชจ๋“œ๋กœ ํ›ˆ๋ จ ๋ณธ ์›Œํฌ์ƒต์˜ ๋ชจ๋“  ๋…ธํŠธ๋ถ์€ **<font color="red">conda_tensorflow2_p36</font>** ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด ๋…ธํŠธ๋ถ์€ ์•„๋ž˜์™€ ๊ฐ™์€ ์ž‘์—…์„ ํ•ฉ๋‹ˆ๋‹ค. - 1. ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ธํŒ… - 2. ๋…ธํŠธ๋ถ์—์„œ ์„ธ์ด์ง€ ๋ฉ”์ด์ปค ์Šคํฌ๋ฆฝํŠธ ๋ชจ๋“œ ์Šคํƒ€์ผ๋กœ ์ฝ”๋“œ ๋ณ€๊ฒฝ - 3. ์„ธ์ด์ง€ ๋ฉ”์ด์ปค ๋กœ์ปฌ ๋ชจ๋“œ๋กœ ํ›ˆ๋ จ - 4. ์„ธ์ด์ง€ ๋ฉ”์ด์ปค์˜ ํ˜ธ์ŠคํŠธ ๋ชจ๋“œ๋กœ ํ›ˆ๋ จ - 5. ๋ชจ๋ธ ์•„ํ‹ฐํŽ™ํŠธ ๊ฒฝ๋กœ ์ €์žฅ --- # 1. ๊ธฐ๋ณธ ํ™˜๊ฒฝ ์„ธํŒ… ์‚ฌ์šฉํ•˜๋Š” ํŒจํ‚ค์ง€๋Š” import ์‹œ์ ์— ๋‹ค์‹œ ์žฌ๋กœ๋”ฉ ํ•ฉ๋‹ˆ๋‹ค. ``...
github_jupyter
**This notebook is an exercise in the [AI Ethics](https://www.kaggle.com/learn/ai-ethics) course. You can reference the tutorial at [this link](https://www.kaggle.com/alexisbcook/ai-fairness).** --- In the tutorial, you learned about different ways of measuring fairness of a machine learning model. In this exercise...
github_jupyter
# Parsing Text and the LDA output ## a.1) Opening pdfs and extracting their text Under the material for Lecture 3 I have added a folder called FOMC_pdf. This folder contains the transcripts of all the meetings that took place during the [Greenspan](https://en.wikipedia.org/wiki/Alan_Greenspan) era (August 11, 1987 to...
github_jupyter
## 03 Intro to PyTorch *special thanks to YSDA team for provided materials* What comes today: - Introduction to PyTorch - Automatic gradient computation - Logistic regression (it's a neural network, actually ;) ) ![img](https://pytorch.org/tutorials/_static/pytorch-logo-dark.svg) __This notebook__ will teach you to...
github_jupyter
Please find jax implementation of this notebook here: https://colab.research.google.com/github/probml/pyprobml/blob/master/notebooks/book1/15/attention_jax.ipynb <a href="https://colab.research.google.com/github/probml/pyprobml/blob/master/notebooks/attention_torch.ipynb" target="_parent"><img src="https://colab.resea...
github_jupyter
<a href="https://colab.research.google.com/github/yukinaga/lecture_pytorch/blob/master/lecture4/cnn.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # CNNใฎๅฎŸ่ฃ… PyTorchใ‚’ไฝฟใฃใฆใ€็•ณใฟ่พผใฟใƒ‹ใƒฅใƒผใƒฉใƒซใƒใƒƒใƒˆใƒฏใƒผใ‚ฏ๏ผˆCNN๏ผ‰ใ‚’ๅฎŸ่ฃ…ใ—ใพใ™ใ€‚ CNN่‡ชไฝ“ใฏCNNใฎๅฑคใ‚’่ฟฝๅŠ ใ™ใ‚‹ใฎใฟใงๅฎŸ่ฃ…ๅฏ่ƒฝใชใฎใงใ™ใŒใ€ไปŠๅ›žใฏใƒ‡ใƒผใ‚ฟๆ‹กๅผตใจใƒ‰ใƒญใƒƒใƒ—ใ‚ขใ‚ฆใƒˆใฎๅฎŸ่ฃ…ใ‚‚่กŒ...
github_jupyter
# Generative Adversarial Network In this notebook, we'll be building a generative adversarial network (GAN) trained on the MNIST dataset. From this, we'll be able to generate new handwritten digits! GANs were [first reported on](https://arxiv.org/abs/1406.2661) in 2014 from Ian Goodfellow and others in Yoshua Bengio'...
github_jupyter
![title](yesbank_feature_banner.png) # YES BANK DATATHON ## Machine Learning Challenge Round 3 - EDA ### Data Description The data given is of credit records of individuals with certain attributes. ``` import numpy as np import pandas as pd import seaborn as sns %matplotlib inline import matplotlib.pyplot as plt t...
github_jupyter
``` %matplotlib inline from jax.config import config; config.update("jax_enable_x64", True) import jax.numpy as jnp from jax import grad, jit, value_and_grad import numpy as np from matplotlib import pyplot as plt from matplotlib import ticker, colors @jit def loss_lik(mu,v): b1 = 0.5; b2 = 0.01; a1 = 2.0; a2 =...
github_jupyter
Week 5 Notebook: Building a Deep Learning Model =============================================================== Now, we'll look at a deep learning model based on low-level track features. ``` import tensorflow.keras as keras import numpy as np from sklearn.metrics import roc_curve, auc import matplotlib.pyplot as plt...
github_jupyter
``` #Estre programa contรฉm os cรณdigo demonstrados na aula sobre Aplicaรงรฃo de ML+IoT para o Healthcare(previsรฃo de arritmia) #importando o banco de dados a ser utilizado (comando necessรกrio para o google colab) from google.colab import files uploaded = files.upload() #importando as bibliotecas import pandas as pd #bibli...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd from tqdm import tqdm from astropy.table import Table import astropy.units as u import os # Using `batman` to create & fit fake transit import batman # Using astropy BLS and scipy curve_fit to fit transit from astropy.timeseries import BoxLeas...
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
# Import Dependencies ``` import warnings warnings.filterwarnings('ignore') import keras import matplotlib.pyplot as plt ``` ## Define Types ``` from typing import Tuple ImageShape = Tuple[int, int] GrayScaleImageShape = Tuple[int, int, int] ``` # MNIST Sandbox Baseline Example This sandbox example is meant mostly...
github_jupyter
``` import os import glob import math import time import pandas as pd import numpy as np import scipy as sc from sklearn.model_selection import KFold import warnings import matplotlib.pyplot as plt import matplotlib from sklearn.model_selection import train_test_split from torch.utils.data import TensorDataset, DataLoa...
github_jupyter
# Introduction So... you've got some interesting property of the network uncovered. Is it real? How can you trust that what you've found **didn't arise by random chance**? One useful way of thinking by using generative models of random graphs. By "generative" and "random", we mean that the graph was generated using s...
github_jupyter
``` import matplotlib #matplotlib.use('Agg') %matplotlib tk %autosave 180 import matplotlib.pyplot as plt from IPython.core.display import display, HTML display(HTML("<style>.container { width:100% !important; }</style>")) import matplotlib.cm as cm from matplotlib import gridspec import parmap import numpy as np impo...
github_jupyter
# Learn Python for Economic Computation: A Crash Course https://github.com/jlcatonjr/Learn-Python-for-Stats-and-Econ > James Caton > > james.caton@ndsu.edu > > Cameron Harwick > > charwick@brockport.edu ### Table of Contents [Introduction](https://github.com/jlcatonjr/Learn-Python-for-Stats-and-Econ/blob/master/Te...
github_jupyter
# ์ •๊ทœ ํ‘œํ˜„์‹ ์‹œ์ž‘ํ•˜๊ธฐ ## ์ •๊ทœ ํ‘œํ˜„์‹์˜ ๊ธฐ์ดˆ, ๋ฉ”ํƒ€ ๋ฌธ์ž ์ •๊ทœ ํ‘œํ˜„์‹์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๋ฉ”ํƒ€ ๋ฌธ์ž(meta characters)์—๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒƒ์ด ์žˆ๋‹ค. โ€ป ๋ฉ”ํƒ€ ๋ฌธ์ž๋ž€ ์›๋ž˜ ๊ทธ ๋ฌธ์ž๊ฐ€ ๊ฐ€์ง„ ๋œป์ด ์•„๋‹Œ ํŠน๋ณ„ํ•œ ์šฉ๋„๋กœ ์‚ฌ์šฉํ•˜๋Š” ๋ฌธ์ž๋ฅผ ๋งํ•œ๋‹ค. - ์‚ฌ์šฉํ•˜๋Š” ๋ฉ”ํƒ€ ๋ฌธ์ž: . ^ $ * + ? { } [ ] \ | ( ) ์ •๊ทœ ํ‘œํ˜„์‹์— ์œ„ ๋ฉ”ํƒ€ ๋ฌธ์ž๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํŠน๋ณ„ํ•œ ์˜๋ฏธ๋ฅผ ๊ฐ–๊ฒŒ ๋œ๋‹ค. ์ž, ๊ทธ๋Ÿฌ๋ฉด ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ์ •๊ทœ ํ‘œํ˜„์‹๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด ๊ฐ ๋ฉ”ํƒ€ ๋ฌธ์ž์˜ ์˜๋ฏธ์™€ ์‚ฌ์šฉ๋ฒ•์„ ์•Œ์•„๋ณด์ž. ## ๋ฌธ์ž ํด๋ž˜์Šค [ ] ...
github_jupyter
``` # Import libraries import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib as mpl from scipy import stats import statsmodels.api as sm import warnings from itertools import product from datetime import datetime warnings.filterwarnings('ignore') plt.style.use('s...
github_jupyter
# Abstract Data Structures: Thinking recursively ## 5.1.1 Identify a situation that requires the use of recursive thinking What is this recursive thing? It's a very practical way of establishing an abstract pattern in our thinking. There are a class of problems that require thinking in a more abstract manner, and try...
github_jupyter
# Creating a Sentiment Analysis Web App ## Using PyTorch and SageMaker _Deep Learning Nanodegree Program | Deployment_ --- Now that we have a basic understanding of how SageMaker works we will try to use it to construct a complete project from end to end. Our goal will be to have a simple web page which a user can u...
github_jupyter
\title{Digital Latches with myHDL} \author{Steven K Armour} \maketitle # Refs @book{brown_vranesic_2014, place={New York, NY}, edition={3}, title={Fundamentals of digital logic with Verilog design}, publisher={McGraw-Hill}, author={Brown, Stephen and Vranesic, Zvonko G}, year={2014} }, @book{lameres_2017, title={Intro...
github_jupyter
``` %%capture # { display-mode: 'form' } # @title PyTTI-Tools [EzMode]: VQGAN # @markdown ## Setup # @markdown This may take a few minutes. ## 1. Install stuff try: import pytti except ImportError: !pip install kornia pytorch-lightning transformers !pip install jupyter loguru einops PyGLM ftfy regex ...
github_jupyter
# Example Script for Logistic Regression for Fishing Detection ``` %matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt from patsy import dmatrices from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn import metrics f...
github_jupyter
<img src="../../images/banners/python-basics.png" width="600"/> # <img src="../../images/logos/python.png" width="23"/> Python Program Lexical Structure You have now covered Python variables, operators, and data types in depth, and youโ€™ve seen quite a bit of example code. Up to now, the code has consisted of short i...
github_jupyter
# Load Data From Snowflake ![Snowflake Logo](https://saturn-public-assets.s3.us-east-2.amazonaws.com/example-resources/snowflake.png "doc-image") ## Overview <a href="https://www.snowflake.com/" target='_blank' rel='noopener'>Snowflake</a> is a data platform built for the cloud that allows for fast SQL queries. This ...
github_jupyter
``` %matplotlib inline ``` Spatial Transformer Networks Tutorial ===================================== **Author**: `Ghassen HAMROUNI <https://github.com/GHamrouni>`_ .. figure:: /_static/img/stn/FSeq.png In this tutorial, you will learn how to augment your network using a visual attention mechanism called spatial t...
github_jupyter
``` %matplotlib inline import torch import torch.nn as nn import matplotlib.pyplot as pt import numpy as np device = torch.device('cpu') # if torch.cuda.is_available() > 0: # print("Using GPU") # device = torch.device('cuda') # else: # print("Using CPU") # Sizes of layers and batch size n_in, n_h, n_out =...
github_jupyter
<a href="https://colab.research.google.com/github/PyTorchLightning/lightning-flash/blob/master/flash_notebooks/image_classification.ipynb" target="_parent"> <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/> </a> In this notebook, we'll go over the basics of lightning Flash b...
github_jupyter
``` import pandas as pd import pathlib # Store filepath in a variable GDP_path = pathlib.Path("../Extraction/GDP_per_capita.csv") # Read and display the CSV with Pandas GDP_file_df = pd.read_csv(GDP_path, encoding="ISO-8859-1") GDP_file_df # Delete columns: 1960 through 2004, Indicator Name, and Indicator Code) GDP_Dr...
github_jupyter
# Symbolic Regression This example combines neural differential equations with regularised evolution to discover the equations $\frac{\mathrm{d} x}{\mathrm{d} t}(t) = \frac{y(t)}{1 + y(t)}$ $\frac{\mathrm{d} y}{\mathrm{d} t}(t) = \frac{-x(t)}{1 + x(t)}$ directly from data. **References:** This example appears as ...
github_jupyter
``` # %cd /Users/Kunal/Projects/TCH_CardiacSignals_F20/ from numpy.random import seed seed(1) import numpy as np import os import matplotlib.pyplot as plt import tensorflow tensorflow.random.set_seed(2) from tensorflow import keras from tensorflow.keras.callbacks import EarlyStopping from tensorflow.keras.regularizers ...
github_jupyter
``` import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) from sklearn.decomposition import PCA # Principal Component Analysis module from sklearn.cluster import KMeans # KMeans clustering import matplotlib.pyplot as plt # Python defacto plotting library import seab...
github_jupyter
# Lecture 3: Birthday Problem, Properties of Probability ## The Birthday Problem Given $k$ people, what is the probability of at least 2 people having the same birthday? First, we need to define the problem: 1. there are 365 days in a year (no leap-years) 1. births can be on any day with equal probability (birthdays...
github_jupyter
# Web Data Extraction (1) by Dr Liang Jin - Step 1: access crawler.idx files from SEC EDGAR - Step 2: re-write crawler data to csv files - Step 3: retrieve 10K filing information including URLs - Step 4: read text from html ## Step 0: Setup... ``` # import packages as usual import os, requests, csv, webbrowser from ...
github_jupyter
``` import pandas as pd import numpy as np from numpy import linalg import matplotlib.pyplot as plt import seaborn as sbn from scipy.stats import invgamma import logging from notebookutils import root_dir; root_dir() from model.utils import read_clean_kv17, read_testdata1, read_party_keys, matrix, vector, party_name_fr...
github_jupyter
``` %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt from astropy import units as u from astroduet.bbmag import bb_abmag_fluence from astroduet.image_utils import construct_image, find from astroduet.config import Telescope from astroduet.background import background_pixel_rate fr...
github_jupyter
# Reinforcement learning In this Python notebook, we will have you implement a simple reinforcement learning agent for the AI gym mountain car problem. Please first have a look at the description of the task here: <A HREF="https://github.com/openai/gym/wiki/MountainCar-v0" TARGET="_blank">Description</A> ## Heuristi...
github_jupyter
``` # 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 License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
github_jupyter
# Parsing Inputs In the chapter on [Grammars](Grammars.ipynb), we discussed how grammars can be used to represent various languages. We also saw how grammars can be used to generate strings of the corresponding language. Grammars can also perform the reverse. That is, given a string, one can decompose the string into ...
github_jupyter
<a href="https://colab.research.google.com/github/txusser/Master_IA_Sanidad/blob/main/Modulo_2/2_3_3_Extraccion_de_caracteristicas.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # Extracciรณn de caracterรญsticas ## Anรกlisis de la componente principa...
github_jupyter
# Multi-linear regression: how many variables? [![Latest release](https://badgen.net/github/release/Naereen/Strapdown.js)](https://github.com/eabarnes1010/course_objective_analysis/tree/main/code) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/eabar...
github_jupyter
## Keras implementation of https://phillipi.github.io/pix2pix ``` import os os.environ['KERAS_BACKEND']='theano' # can choose theano, tensorflow, cntk os.environ['THEANO_FLAGS']='floatX=float32,device=cuda,optimizer=fast_run,dnn.library_path=/usr/lib' #os.environ['THEANO_FLAGS']='floatX=float32,device=cuda,optimizer=f...
github_jupyter
# Practical session 1 - Some Python basics Course: [SDIA-Python](https://github.com/guilgautier/sdia-python) Dates: 09/21/2021-09/22/2021 Instructor: [Guillaume Gautier](https://guilgautier.github.io/) Students (pair): - [Hadrien SALEM]([link](https://github.com/SnowHawkeye)) - [Emilie SALEM]([link](https...
github_jupyter
``` import gc import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import torch import torch.nn as nn import torchvision # To view tensorboard metrics # tensorboard --logdir=logs --port=6006 --bind_all from torch.utils.tensorboard import SummaryWriter from functools import partial from evol...
github_jupyter
The $k$-Means Algorithm ==================== Again, we start by generating some artificial data: ``` import numpy as np import matplotlib.pyplot as plt #from IPython.display import HTML # This line tells the notebook to show plots inside of the notebook %matplotlib inline plt.jet() # set the color map. When your colo...
github_jupyter
# Exploring Data with Python A significant part of a a data scientist's role is to explore, analyze, and visualize data. There's a wide range of tools and programming languages that they can use to do this; and of of the most popular approaches is to use Jupyter notebooks (like this one) and Python. Python is a flexi...
github_jupyter
<a href="https://colab.research.google.com/github/mohd-faizy/CAREER-TRACK-Data-Scientist-with-Python/blob/main/Police_Activity_data_for_analysis.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> --- <strong> <h1 align='center'>Preparing the Po...
github_jupyter
# Workshop: Deep Learning 3 Outline 1. Regularization 2. Hand-Written Digits with Convolutional Neural Networks 3. Advanced Image Classification with Convolutional Neural Networks Source: Deep Learning With Python, Part 1 - Chapter 4 ## 1. Regularization To prevent a model from learning misleading or irrelevant ...
github_jupyter
<center> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/Logos/organization_logo/organization_logo.png" width="300" alt="cognitiveclass.ai logo" /> </center> # Density-Based Clustering Estimated time needed: **25** minutes ## Objectives After completing this lab you w...
github_jupyter
``` from pyspark import SparkContext, SparkConf from pyspark.sql import SQLContext, SparkSession from pyspark.sql.types import StructType, StructField, DoubleType, IntegerType, StringType from ibm_botocore.client import Config import ibm_boto3 import os from pyspark.sql.functions import unix_timestamp, to_date import ...
github_jupyter
``` from math import sqrt import pandas as pd import numpy as np import matplotlib.pyplot as plt # for the ML pipeline from sklearn.model_selection import train_test_split from sklearn.impute import SimpleImputer from sklearn.preprocessing import OrdinalEncoder from sklearn.ensemble import GradientBoostingRegressor f...
github_jupyter
``` prefix = 'ens' midx = '66' import pandas as pd import numpy as np from sklearn.metrics import f1_score, confusion_matrix new = pd.read_csv('leak2d.csv') new = new[new.Questionable != 1] new.reset_index(inplace=True) print(new.head()) print(new.shape) ens = pd.read_csv('sub/'+prefix+midx+'.csv').fillna('') ens = en...
github_jupyter
# ORF MLP Trying to fix bugs. NEURONS=128 and K={1,2,3}. ``` import time def show_time(): t = time.time() print(time.strftime('%Y-%m-%d %H:%M:%S %Z', time.localtime(t))) show_time() PC_TRAINS=8000 NC_TRAINS=8000 PC_TESTS=8000 NC_TESTS=8000 RNA_LEN=1000 MAX_K = 3 INPUT_SHAPE=(None,84) # 4^3 + 4^2 + 4...
github_jupyter
``` import xarray as xr import pandas as pd import pickle as pk import re import requests import os import gc # Sensor E: url = 'https://opendap.oceanobservatories.org/thredds/catalog/ooi/dax.soule@qc.cuny.edu/20181104T104012-RS03ECAL-MJ03E-06-BOTPTA302-streamed-botpt_nano_sample/catalog.html' # Sensor B url = 'https:/...
github_jupyter
``` import google.datalab.bigquery as bq import numpy as np from sklearn.metrics import mean_squared_error, mean_absolute_error import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf #training price data training = bq.Query(''' Select date_utc,price from Energy.MarketPT where date_utc between '2015...
github_jupyter
# Inter-annotator agreement between the first 10 annotators of WS-353 Measured in Kappa and Rho: - against the gold standard which is the mean of all annotators, as described in Hill et al 2014 (footnote 6) - against each other Using Kohen's kappa, which is binary, so I average across pairs of annotators. ``` %cd...
github_jupyter
# **Applied Deep Learning Tutorial** ## **Transfer Learning for Object Classification** ### **Imports** Import the necessary libraries and load the Dogs vs Cats dataset from Kaggle. ``` from __future__ import absolute_import, division, print_function, unicode_literals import os try: # Use the %tensorflow_versi...
github_jupyter
# General Funds ``` import pandas as pd import seaborn as sns from matplotlib import pyplot as plt import mwdsbe import schuylkill as skool import time ``` ## Data ``` registry = mwdsbe.load_registry() # geopandas df gf = pd.read_excel(r'C:\Users\dabinlee\Documents\GitHub\mwdsbe_binny\MWDSBE\mwdsbe\data\cwedp_37_rep...
github_jupyter
# Introduรงรฃo ``` import os import re import time import json import folium import random import requests import numpy as np import pandas as pd import seaborn as sns import geopandas as gpd from folium import plugins from osgeo import gdal, osr from bs4 import BeautifulSoup from tqdm.notebook import trange, tqdm ``` ...
github_jupyter